afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
[personal profile] afuna
(Or: when your focus listener interferes with your click listener) Demo.

Stumbled across it while I was working on the new update page, and it held me up a while. Eventually, I decided to use another approach.

Playing with the thought of submitting it as a bug, but it may be expected quirky behavior -- at least, it behaves the same way in both Firefox and Opera. Chrome, meanwhile, does not suffer from the problem, but that may be sheer accident: Chrome doesn't trigger the focus event when you use the mouse, only when you use the keyboard. So in Firefox/Opera, the click event doesn't work; in Chrome, it's the focus event that doesn't show up.

Browsers: they are strange animals.

PS. If you edit the URL to see previous versions of the fiddle, you'll see that I originally thought that the presence of images had something to do with it, ehehe.

Date: 2010-05-21 06:33 am (UTC)
exor674: Computer Science is my girlfriend (Default)
From: [personal profile] exor674
That's... weird!

Date: 2010-05-22 03:39 am (UTC)
exor674: Computer Science is my girlfriend (Default)
From: [personal profile] exor674
Oh, you know if you need focus and click to fire, and focus hides things, a good workaround would be to in the focus action do a setTimeout of say, 25ms or something -- should be imperceptible, but should allow time for the click to fire