I. Steps: ----------- 1. Launch Safari 2. Launch the attached testcase 3. Try focussing the button (or) clicking on the button II. Issue: ----------------- Alert box should show up when onfocus fires. But it doesn't happen in Safari. III. Other browsers: ----------------------- IE7 : ok FF3 : ok Opera 9.50: ok IV. Safari nightly tested: version 3.1.1(525.17 )- r34603. Not working properly on Safari. V. Safari screenshot : Not Avalible
Created attachment 22215 [details] reduction.zip
Hi, I have been analysing this bug, these are the observation made: In webkit\webcore\dom\eventtargetnode.cpp file, under EventTargetNode::handleLocalEvents(Event* event, bool useCapture) method if (r.eventType() == event->type().....) condition fails since the r.eventType() is "focus" and event->type() is "click". so the condition fails hence we wont get the alert message. I added event->type()==eventNames().clickEvent ORed with the r.eventType() == event->type()in the if statement. This would solve the problem.
Created attachment 32021 [details] Tests the onfocus handler for a div It looks like the problem has moved to Node::handleLocalEvents as EventTargetNode no longer exists (http://trac.webkit.org/changeset/40675).
Created attachment 32108 [details] Shows how the onfocus handler does get called if the tabindex is set to -1 In accordance with the HTML5 spec, the onfocus handler of a div will only be called if that div has a tabIndex set: http://dev.w3.org/html5/spec/Overview.html#focus