Skip to main content
Meng Zhiqun
Inspiring
November 27, 2023
Answered

eventListener firing twice on mac

  • November 27, 2023
  • 1 reply
  • 217 views
                    function mainListBoxEventListener(event){
                        var keyCode = event.keyName;
                        // Check if the key pressed is the Enter key (Key code: 13)
                        if (keyCode === "Enter") {
                            alert("entertest")
                        }else if(keyCode === "Down"){
                            alert("downtest")
                        }else if(keyCode === "Up"){
                            alert("uptest")
                        }else if (keyCode === "Escape") {
                            myPanel.close();
                            return false;
                        }
                        event.stopPropagation();
                    }

                    myPanel.grp.inputGroup.textFieldGroup.httpGroup.httpEditText.addEventListener("keydown", mainListBoxEventListener);


This is a snippet of my code (please ignore the commented section). It runs fine on Windows, with all the keys firing once. However, when I run the same code on mac, it always ends up firing twice, I can't seem to find the root source of the problem other than thinking it's a bug.

Hoping someone can help me here! TIA!

This topic has been closed for replies.
Correct answer Meng Zhiqun

I solved it and it was related to something else entirely.

1 reply

Meng Zhiqun
Meng ZhiqunAuthorCorrect answer
Inspiring
November 27, 2023

I solved it and it was related to something else entirely.