Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#7768 closed bug (invalid)

Focus Event does not get triggered in Safari and Chrome

Reported by: anonymous Owned by:
Priority: undecided Milestone: 1.6
Component: event Version: 1.3.1
Keywords: Cc:
Blocked by: Blocking:


There is a nice demo for this online: http://pastebin.me/973509bd873d9ef90fa19c961e77fb27

Change History (3)

comment:1 Changed 12 years ago by jitter

Component: unfiledevent

Thanks for taking the time to contribute to the jQuery project by writing a bug report and providing a test case! After checking your report and test case it's unclear why you did report this for version 1.3.1? Anyhow, this isn't a jQuery issue but a browser issue. From focs() documentation.

This event is implicitly applicable to a limited set of elements


The focus is used to determine which element is the first to receive keyboard-related events.


In recent browser versions, the event can be extended to include all element types by explicitly setting the element's tabindex property

Also look at e.g. quirksmode focus table (may not be uptodate) which gives a nice impression on how differently this event is supported across browsers.

In Chrome/Safari certain elements simply don't get the "keyboard focus" when clicking on them, you can see that they are not highlighted and that e.g. hitting ENTER/SPACE doesn't do anything to the e.g button you just clicked. But you can give these elements the focus by using the TAB key and voilà the event is triggered.

This is actually a Webkit bug (bug #22261) and it isn't clear if they are ever going to fix this or just keeping it like this because that's how Mac/Safari did this the last 8 years.

test case where you can try out the TAB focus thingy and see that tabIndex makes also the stuff in the 3rd box focusable.

I guess this is a wontfix but leaving it still open so others can share their view on this one.

comment:2 Changed 12 years ago by snover

Resolution: invalid
Status: newclosed

Technically, certain elements don’t focus when they are clicked on, they just activate. This varies between browsers and operating system HIGs. (For instance, clicking a button in Mac OS never focuses it on *any* browser.) It’s not a bug. Also, the code in jitter’s test case is a bit wrong—tabindex -1 disables focusability; tabindex ≥0 enables it. revised test case

comment:3 Changed 12 years ago by jitter

Oh well... damn me for just trying to click on them to check if focus works after setting tabIndex. Because that works with -1 too, you just can't "tab" to them.

Version 0, edited 12 years ago by jitter (next)
Note: See TracTickets for help on using tickets.