View Full Version : mouse event handler cancels keypress handler

09-30-2012, 06:19 AM
I have an app where there are mouse events used for DHTML and keypress events used for the same exact same action.
The app is told by the user to register keypress events by checking a checkbox.
If the user checks the box and starts using the arrow keys, and then switches to the mouse to do the same action,
then goes back to the arrow keys, the arrow keypress events do not work.
The user must uncheck the checkbox and recheck it for the arrow keys to function again.
Currently the keypress event handling is being developed and tested only in
FF on Mac OSX.

Hopefully I don't have to post a lot of code, because there is a lot to sort

Philip M
09-30-2012, 11:17 AM
If you don't post the (relevant) code I don't see how anyone can help you.

It is your responsibility to die() if necessary….. - PHP Manual

09-30-2012, 10:20 PM
There are at least a thousand lines (by the way I format my code) of relevant code.
That could be trimmed to around 500 lines for this post. I have been
wrapping as much code as possible into constructor functions. So an
argument passed to a method could refer to another section of code that
someone would have to look at to get the whole story.

I was hoping to get a response from someone who had specific experience
with this phenom.

BUT, I was testing in an older version of Firefox. New versions and other DOM browsers
would not run the key events as coded, at all. So I am trying to use arrow keys,
and was trying charCode, when I should have been using keydown events
and looking for keyCode. I also need to add the event listeners
to the document, rather than a specific element in the document.

That solved the problem in the newer FF, and others. These also do not have
the same 'mouse event cancels key event' problem I originally encountered

So considering the age of that test version, I could probably ignore it.