Bug 19983 - DOM event handler onfocus not fired
Summary: DOM event handler onfocus not fired
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-10 15:23 PDT by Calvin Anderson
Modified: 2009-06-30 20:38 PDT (History)
1 user (show)

See Also:


Attachments
reduction.zip (534 bytes, application/octet-stream)
2008-07-10 15:23 PDT, Calvin Anderson
no flags Details
Tests the onfocus handler for a div (1.30 KB, text/html)
2009-06-29 14:52 PDT, Jessie Berlin
no flags Details
Shows how the onfocus handler does get called if the tabindex is set to -1 (1.36 KB, text/html)
2009-06-30 20:37 PDT, Jessie Berlin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Calvin Anderson 2008-07-10 15:23:17 PDT
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
Comment 1 Calvin Anderson 2008-07-10 15:23:19 PDT
Created attachment 22215 [details]
reduction.zip
Comment 2 swethanagaraj 2009-05-21 21:53:37 PDT
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.
Comment 3 Jessie Berlin 2009-06-29 14:52:44 PDT
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).
Comment 4 Jessie Berlin 2009-06-30 20:37:53 PDT
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