Skip to main content

Bug Tracker

Side navigation

#7768 closed bug (invalid)

Opened December 13, 2010 10:24PM UTC

Closed December 14, 2010 06:48AM UTC

Last modified December 14, 2010 08:52AM UTC

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:
Description

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

Attachments (0)
Change History (3)

Changed December 14, 2010 12:59AM UTC by jitter comment:1

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

and

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

and

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.

Changed December 14, 2010 06:48AM UTC by snover comment:2

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

Changed December 14, 2010 08:52AM UTC by jitter comment:3

_comment0: 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.1292329391120456

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.

just to clarify: HIG --> Human interface guidelines