Bug 71854 - Access key should work on all elements
Summary: Access key should work on all elements
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: http://dev.w3.org/html5/spec/Overview...
Keywords:
: 72206 (view as bug list)
Depends on: 72210 73917
Blocks: 72359
  Show dependency treegraph
 
Reported: 2011-11-08 13:42 PST by Erik Arvidsson
Modified: 2011-12-06 06:08 PST (History)
14 users (show)

See Also:


Attachments
Test Case 1 (372 bytes, text/html)
2011-11-09 01:24 PST, Vineet Chaudhary (vineetc)
no flags Details
Test Case 2 (522 bytes, text/html)
2011-11-09 01:30 PST, Vineet Chaudhary (vineetc)
no flags Details
Proposed Patch (3.66 KB, patch)
2011-11-09 04:19 PST, Vineet Chaudhary (vineetc)
rniwa: review-
Details | Formatted Diff | Diff
Updated Patch (18.99 KB, patch)
2011-11-09 22:56 PST, Vineet Chaudhary (vineetc)
abarth: review-
abarth: commit-queue-
Details | Formatted Diff | Diff
Patch (19.09 KB, patch)
2011-11-10 02:45 PST, Vineet Chaudhary (vineetc)
no flags Details | Formatted Diff | Diff
Updated patch as per review comments to fix mac builds. (21.63 KB, patch)
2011-11-12 21:32 PST, Vineet Chaudhary (vineetc)
no flags Details | Formatted Diff | Diff
patch (22.24 KB, patch)
2011-11-14 12:46 PST, Vineet Chaudhary (vineetc)
rniwa: review-
rniwa: commit-queue-
Details | Formatted Diff | Diff
Updated Patch (33.16 KB, patch)
2011-11-17 04:22 PST, Vineet Chaudhary (vineetc)
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff
fixing faling test (33.08 KB, patch)
2011-11-17 07:27 PST, Vineet Chaudhary (vineetc)
rniwa: review-
Details | Formatted Diff | Diff
Updated Patch (56.58 KB, patch)
2011-11-18 03:12 PST, Vineet Chaudhary (vineetc)
rniwa: review+
rniwa: commit-queue-
Details | Formatted Diff | Diff
patch (56.61 KB, patch)
2011-11-18 11:54 PST, Vineet Chaudhary (vineetc)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Arvidsson 2011-11-08 13:42:46 PST
Access key should work on all elements
Comment 1 Ojan Vafai 2011-11-08 13:45:21 PST
Makes sense to me, but we should investigate what other browsers do first. Also, do you have a link to the spec that claims this should work?
Comment 2 Erik Arvidsson 2011-11-08 18:28:30 PST
(In reply to comment #1)
> Makes sense to me, but we should investigate what other browsers do first. Also, do you have a link to the spec that claims this should work?

See URL of the bug
Comment 3 Vineet Chaudhary (vineetc) 2011-11-09 01:24:29 PST
Created attachment 114223 [details]
Test Case 1

I tested this behavior on IE(7), Firefox(7.0.1) and Opera with attached test case.

It is observed that except webkit(gtk port) all returns null(empty srting) value where as webkit gtk alerts undefined.

Adding below code to HTMLElement.idl will enable to work accessKey to other elements too.

attribute [Reflect] DOMString accessKey;
Comment 4 Vineet Chaudhary (vineetc) 2011-11-09 01:30:22 PST
Created attachment 114225 [details]
Test Case 2

Also it is observed that on IE(7) apart from input and anchor element other element (here in case) div element also have accessKey property.
On IE div element gets focus on pressing Alt+d. 

May be this could be handled in HTMLElement::accessKeyAction(bool sendToAnyElement).

Please let me know your thoughts on this?
Comment 5 Vineet Chaudhary (vineetc) 2011-11-09 04:19:29 PST
Created attachment 114247 [details]
Proposed Patch

Attaching proposed patch.

Please let me know your comments on this.
Comment 6 Vineet Chaudhary (vineetc) 2011-11-09 04:24:39 PST
Comment on attachment 114247 [details]
Proposed Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=114247&action=review

> LayoutTests/fast/forms/access-key-for-all-elements.html:8
> +<div id="test"></div>

Currently it is checking only for DIV element which doesn't works with "accessKey" by default. With this patch it is expected to work now for DIV as well as all other elements.
I tried to have test to check for all element but couldn't find any. Please let me know if anyone have better thoughts to check for all "Elements", thanks.
Comment 7 Adam Barth 2011-11-09 08:37:26 PST
Comment on attachment 114247 [details]
Proposed Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=114247&action=review

> Source/WebCore/ChangeLog:10
> +        As per specification http://dev.w3.org/html5/spec/Overview.html#elements-in-the-dom
> +        says All HTML elements can have the accesskey content attribute set. Adding "accessKey"
> +        attribute idl file as [Reflect].

Do we need to remove accessKey from any other IDL files (i.e., because they're now redundant)?
Comment 8 Vineet Chaudhary (vineetc) 2011-11-09 09:21:13 PST
(In reply to comment #7)
> (From update of attachment 114247 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=114247&action=review
> 
> > Source/WebCore/ChangeLog:10
> > +        As per specification http://dev.w3.org/html5/spec/Overview.html#elements-in-the-dom
> > +        says All HTML elements can have the accesskey content attribute set. Adding "accessKey"
> > +        attribute idl file as [Reflect].
> 
> Do we need to remove accessKey from any other IDL files (i.e., because they're now redundant)?

I think we should keep them because "accessKey" attribute implementation is different for different elements.
Eg. For Input element(type=text) it sets the Focus while for anchor element it simulates click events.
Ref :  http://trac.webkit.org/browser/trunk/Source/WebCore/html/InputType.cpp#L445 and http://trac.webkit.org/browser/trunk/Source/WebCore/html/HTMLAnchorElement.cpp#L236

Or else should we move these implementations to HTMLElement::accessKeyAction() with if checks for each different element as you suggests.
Comment 9 Adam Barth 2011-11-09 09:24:57 PST
I'm not sure I understand.  This IDL attribute just reflects the DOM attribute.  Many DOM attribute mean different things on different elements.  Usually there isn't much of a reason to specify them redundantly in the IDL.
Comment 11 Ryosuke Niwa 2011-11-09 09:26:53 PST
Comment on attachment 114247 [details]
Proposed Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=114247&action=review

r- because there are redundant IDL attribute entries.

>> LayoutTests/fast/forms/access-key-for-all-elements.html:8
>> +<div id="test"></div>
> 
> Currently it is checking only for DIV element which doesn't works with "accessKey" by default. With this patch it is expected to work now for DIV as well as all other elements.
> I tried to have test to check for all element but couldn't find any. Please let me know if anyone have better thoughts to check for all "Elements", thanks.

We need to test more than just div. I suggest you copy the list of elements out of HTMLNames and test all elements in some loop.
Comment 12 Vineet Chaudhary (vineetc) 2011-11-09 22:56:29 PST
Created attachment 114441 [details]
Updated Patch

Thanks Adam/Ryosuke for inputs.

(In reply to comment #11)
> r- because there are redundant IDL attribute entries.

Removed redundant IDL attribute entries.

> >> LayoutTests/fast/forms/access-key-for-all-elements.html:8
> We need to test more than just div. I suggest you copy the list of elements out of HTMLNames and test all elements in some loop.

Added more test coverage to all elements.
Comment 13 Adam Barth 2011-11-09 23:31:34 PST
Comment on attachment 114441 [details]
Updated Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=114441&action=review

> LayoutTests/fast/forms/access-key-for-all-elements.html:32
> +for (var i =0 ; i < test.length; i++) {
> +var parent = document.createElement(test[i]);
> +document.body.appendChild(parent);
> +var test_me = document.getElementsByTagName(test[i])[0];
> +debug('Check for ' + test_me.tagName + ' tag');
> +shouldBeDefined('test_me.accessKey');
> +test_me.accessKey ='k';
> +accesskey = test_me.accessKey; 
> +shouldBe('accesskey',"'k'");
> +debug('');
> +}

Please intent this code properly.
Comment 14 WebKit Review Bot 2011-11-09 23:56:25 PST
Comment on attachment 114441 [details]
Updated Patch

Attachment 114441 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/10399267

New failing tests:
fast/forms/access-key-for-all-elements.html
Comment 15 Vineet Chaudhary (vineetc) 2011-11-10 02:45:06 PST
Created attachment 114462 [details]
Patch

Updated patch with proper indentation.
Comment 16 WebKit Review Bot 2011-11-10 10:17:19 PST
Comment on attachment 114462 [details]
Patch

Rejecting attachment 114462 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2

Last 500 characters of output:
e directory and try again.
Re-trying 'depot_tools/gclient sync'
Error: Can't switch the checkout to http://v8.googlecode.com/svn/trunk@9897; UUID don't match and there is local changes in /mnt/git/webkit-commit-queue/Source/WebKit/chromium/v8. Delete the directory and try again.
Error: 'depot_tools/gclient sync' failed 3 tries and returned 256 at Tools/Scripts/update-webkit-chromium line 107.
Re-trying 'depot_tools/gclient sync'
No such file or directory at Tools/Scripts/update-webkit line 111.

Full output: http://queues.webkit.org/results/10403364
Comment 17 Vineet Chaudhary (vineetc) 2011-11-10 10:31:14 PST
Comment on attachment 114462 [details]
Patch

I am not sure why its failing to checkout the v8, but I see many patches in commit queue are failing right now with the same reason :(. Setting cq flag again.
Comment 18 WebKit Review Bot 2011-11-11 13:59:05 PST
Comment on attachment 114462 [details]
Patch

Clearing flags on attachment: 114462

Committed r100013: <http://trac.webkit.org/changeset/100013>
Comment 19 WebKit Review Bot 2011-11-11 13:59:11 PST
All reviewed patches have been landed.  Closing bug.
Comment 20 Joseph Pecoraro 2011-11-11 22:33:57 PST
I'm assuming after this I'm seeing build errors from the bindings generator on Mac builds:

    Died at WebCore/bindings/scripts//CodeGeneratorObjC.pm line 323.
    Public API change. There are missing public properties and/or methods from the "DOMHTMLAnchorElement" class.
    @property(copy) NSString *accessKey;

CodeGeneratorObjC.pm checks the new APIs against
Source/WebCore/bindings/objc/PublicDOMInterfaces.h. Should this file
be updated now that accessKey is available on DOMHTMLElement?
Comment 21 Joseph Pecoraro 2011-11-11 22:44:35 PST
(In reply to comment #20)
> I'm assuming after this I'm seeing build errors from the bindings generator on Mac builds:
> 
>     Died at WebCore/bindings/scripts//CodeGeneratorObjC.pm line 323.
>     Public API change. There are missing public properties and/or methods from the "DOMHTMLAnchorElement" class.
>     @property(copy) NSString *accessKey;
> 
> CodeGeneratorObjC.pm checks the new APIs against
> Source/WebCore/bindings/objc/PublicDOMInterfaces.h. Should this file
> be updated now that accessKey is available on DOMHTMLElement?

I opened:
<http://webkit.org/b/72206> ObjC API accessKey moved up to superclass DOMHTMLElement
Comment 22 Nikolas Zimmermann 2011-11-12 02:56:19 PST
This breaks the mac build! When I landed my patch from bug 72105, the problem first appeared on the bots, but several people on IRC reported that build was already broken.


Public API change. There are missing public properties and/or methods from the "DOMHTMLAreaElement" class.
@property(copy) NSString *accessKey;
Died at WebCore/bindings/scripts//CodeGeneratorObjC.pm line 323.
Public API change. There are missing public properties and/or methods from the "DOMHTMLAnchorElement" class.
@property(copy) NSString *accessKey;
Died at WebCore/bindings/scripts//CodeGeneratorObjC.pm line 323.

...

PublicDOMInterfaces.h in bindings/objc lists accessKey. Now if you remove it, CodeGenObjC.pm will die with a fatal error!

I guess we should roll it out quickly, it induces problems on all mac builds since a while.
Comment 23 Erik Arvidsson 2011-11-12 13:38:22 PST
This is easy to fix. You need to update Source/WebCore/bindings/objc/PublicDOMInterfaces.h and add accessKey to DOMHTMLElement  and remove it from all the its subclasses.
Comment 24 Vineet Chaudhary (vineetc) 2011-11-12 21:32:56 PST
Created attachment 114851 [details]
Updated patch as per review comments to fix mac builds.

(In reply to comment #23)
> This is easy to fix. You need to update Source/WebCore/bindings/objc/PublicDOMInterfaces.h and add accessKey to DOMHTMLElement  and remove it from all the its subclasses.

Sorry for delayed response and inconvenience caused.
As I see this patch was rolled-out in http://trac.webkit.org/changeset/100076.

Thanks Erik for help but unfortunately I don't have access to MAC machine/build. Still I have updated PublicDOMInterfaces.h moving accessKey from subclasses to base class but needs to be verified. 
It would be great help if someone with MAC access helps verifying this new patch.
Comment 25 Ryosuke Niwa 2011-11-13 23:25:17 PST
(In reply to comment #24)
> Created an attachment (id=114851) [details]
> Updated patch as per review comments to fix mac builds.

I have confirmed that this patch builds on Mac.
Comment 26 Adam Barth 2011-11-13 23:30:51 PST
Comment on attachment 114851 [details]
Updated patch as per review comments to fix mac builds.

My understanding is that this should be ok because you're just moving the method up the object hierarchy.  We can check with more Objective-C knowledgable folks if you'd like.
Comment 27 Vineet Chaudhary (vineetc) 2011-11-13 23:41:52 PST
Thanks Ryosuke, for quick update. :)


(In reply to comment #26)
> (From update of attachment 114851 [details])
> My understanding is that this should be ok because you're just moving the method up the object hierarchy.  We can check with more Objective-C knowledgable folks if you'd like.

Yes sure.
Hello Sam Weinig,

Can you please review this change relates to Objective-C tin PublicDOMInterfaces.h.
Comment 28 Joseph Pecoraro 2011-11-14 10:18:19 PST
*** Bug 72206 has been marked as a duplicate of this bug. ***
Comment 29 Erik Arvidsson 2011-11-14 10:27:16 PST
Comment on attachment 114851 [details]
Updated patch as per review comments to fix mac builds.

View in context: https://bugs.webkit.org/attachment.cgi?id=114851&action=review

Some hints on making the test cleaner.

> LayoutTests/fast/forms/access-key-for-all-elements.html:6
> +<p>This test checks to see if accesskey attributes works all elements.</p>

Use the description function instead.

> LayoutTests/fast/forms/access-key-for-all-elements.html:7
> +<div id="test"></div>

This element is never used

> LayoutTests/fast/forms/access-key-for-all-elements.html:8
> +<div id="console"></div>

Remove console element. It is not needed

> LayoutTests/fast/forms/access-key-for-all-elements.html:12
> +if (window.layoutTestController)
> +    layoutTestController.dumpAsText();

Remove, these are note needed

> LayoutTests/fast/forms/access-key-for-all-elements.html:14
> +var test = new Array("a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdo","bgsound","big","blockquote",

var test = ["a", ...];

> LayoutTests/fast/forms/access-key-for-all-elements.html:25
> +    var test_me = document.getElementsByTagName(test[i])[0];

WebKit style is to use camelCase.

A simpler solution might be to do:

var testElement = document.querySelector(tagNames[i]);

btw, I would probably rename test to tagNames or something more descriptive.
Comment 30 Alexey Proskuryakov 2011-11-14 10:44:52 PST
> Use the description function instead.

In fact, I recommend to the contrary. The description function is a leftover from the days when we had a separate and immutable HTML wrapper. Using a <p> element is a much more direct way to have a text in output.

> document.querySelector

Do all browsers we want to compare to support document.querySelector? It's good to get testing for newer features, as long as that doesn't make tests less compatible.

That said, does the test pass in both IE and Firefox as is?
Comment 31 Vineet Chaudhary (vineetc) 2011-11-14 12:46:47 PST
Created attachment 115012 [details]
patch

Updating patch to incorporate Erik's suggestions.
Comment 32 Vineet Chaudhary (vineetc) 2011-11-15 22:37:46 PST
Could someone help me to land this patch. This also blocking Bug 72359.
Comment 33 Ryosuke Niwa 2011-11-17 00:23:54 PST
Comment on attachment 115012 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=115012&action=review

r- due to nits.

> Source/WebCore/ChangeLog:9
> +        says All HTML elements can have the accesskey content attribute set. Adding "accessKey"

Nit: says All?

> Source/WebCore/ChangeLog:10
> +        attribute idl file as [Reflect].

Please make 'Adding "accessKey" attribute idl file as [Reflect]' a full sentence.

> Source/WebCore/ChangeLog:14
> +        * bindings/objc/PublicDOMInterfaces.h: Moving properties form subclass to base class.

s/Moving/Moved/

> LayoutTests/fast/forms/access-key-for-all-elements-expected.txt:1
> +This test checks to see if accesskey attributes works all elements.

Nit: works *on* all elements

> LayoutTests/fast/forms/access-key-for-all-elements.html:1
> +<html>

No DOCTYPE?

> LayoutTests/fast/forms/access-key-for-all-elements.html:10
> +                     "body","br","button","canvas","caption","center","cite","code","col","colgroup","command","datalist","dd","del","details","dfn","dir","div","dl","dt",

We don't normally indent like this. Just intend by 4 spaces please.

> LayoutTests/fast/forms/access-key-for-all-elements.html:19
> +    var parent = document.createElement(tagNames[i]);
> +    document.body.appendChild(parent);

This isn't a parent, right? This IS the test element.

> LayoutTests/fast/forms/access-key-for-all-elements.html:20
> +    var testElement = document.querySelector(tagNames[i]);

Why do we need to query-select it?

> LayoutTests/fast/forms/access-key-for-all-elements.html:25
> +    accesskey = testElement.accessKey; 
> +    shouldBe('accesskey',"'k'");

Why do we ned to copy it to accesskey here? You could have just written
shouldBe('testElement.accessKey',"'k'");
Comment 34 Ryosuke Niwa 2011-11-17 00:30:57 PST
Comment on attachment 115012 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=115012&action=review

Also, I'll add a test to make sure accessKey is actually working; i.e. click() is called (see http://dev.w3.org/html5/spec/Overview.html#command-facet-action).

> Source/WebCore/ChangeLog:8
> +        As per specification http://dev.w3.org/html5/spec/Overview.html#elements-in-the-dom

This should be http://dev.w3.org/html5/spec/Overview.html#the-accesskey-attribute instead.
Comment 35 Vineet Chaudhary (vineetc) 2011-11-17 04:22:37 PST
Created attachment 115558 [details]
Updated Patch

(In reply to comment #33)

> > Source/WebCore/ChangeLog:9
> > +        says All HTML elements can have the accesskey content attribute set. Adding "accessKey"
> Nit: says All?
Corrected.
 
> > Source/WebCore/ChangeLog:10
> > +        attribute idl file as [Reflect].
> Please make 'Adding "accessKey" attribute idl file as [Reflect]' a full sentence.
Corrected.

> > Source/WebCore/ChangeLog:14
> > +        * bindings/objc/PublicDOMInterfaces.h: Moving properties form subclass to base class.
> s/Moving/Moved/
Corrected. 

> > LayoutTests/fast/forms/access-key-for-all-elements-expected.txt:1
> > +This test checks to see if accesskey attributes works all elements.
> Nit: works *on* all elements
Corrected.
 
> > LayoutTests/fast/forms/access-key-for-all-elements.html:1
> > +<html>
> No DOCTYPE?
Corrected.
 
> > LayoutTests/fast/forms/access-key-for-all-elements.html:10
> > +                     "body","br","button","canvas","caption","center","cite","code","col","colgroup","command","datalist","dd","del","details","dfn","dir","div","dl","dt",
> We don't normally indent like this. Just intend by 4 spaces please.
Corrected.
 
> > LayoutTests/fast/forms/access-key-for-all-elements.html:19
> > +    var parent = document.createElement(tagNames[i]);
> > +    document.body.appendChild(parent);
> 
> This isn't a parent, right? This IS the test element.
Corrected.
> > LayoutTests/fast/forms/access-key-for-all-elements.html:20
> > +    var testElement = document.querySelector(tagNames[i]);
> 
> Why do we need to query-select it?
Removed as using direct created element. 
> > LayoutTests/fast/forms/access-key-for-all-elements.html:25
> > +    accesskey = testElement.accessKey; 
> > +    shouldBe('accesskey',"'k'");
> 
> Why do we ned to copy it to accesskey here? You could have just written
> shouldBe('testElement.accessKey',"'k'");
Corrected.

Also modified test to make sure accessKey is actually working.
Checking onclick/onfocus events are fired for elements.
Comment 36 WebKit Review Bot 2011-11-17 05:17:16 PST
Comment on attachment 115558 [details]
Updated Patch

Attachment 115558 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/10510174

New failing tests:
fast/forms/access-key-for-all-elements.html
Comment 37 Vineet Chaudhary (vineetc) 2011-11-17 07:23:19 PST
Comment on attachment 115558 [details]
Updated Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=115558&action=review

> LayoutTests/fast/forms/access-key-for-all-elements-expected.txt:101
> +BUTTON element was focused.

Surprisingly when this test runs alone it sends two extra focus events, but when it run as run-webkit-tests LayoutTests/fast/forms/ ie. complete folder it doesn't send extra focus events interdependent of this patch.
Comment 38 Vineet Chaudhary (vineetc) 2011-11-17 07:27:49 PST
Created attachment 115586 [details]
fixing faling test

(In reply to comment #37)
> (From update of attachment 115558 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=115558&action=review
> 
> > LayoutTests/fast/forms/access-key-for-all-elements-expected.txt:101
> > +BUTTON element was focused.
> 
> Surprisingly when this test runs alone it sends two extra focus events, but when it run as run-webkit-tests LayoutTests/fast/forms/ ie. complete folder it doesn't send extra focus events interdependent of this patch.

Attempting to fix failing test case.
Comment 39 Ryosuke Niwa 2011-11-17 22:54:51 PST
Comment on attachment 115586 [details]
fixing faling test

View in context: https://bugs.webkit.org/attachment.cgi?id=115586&action=review

> Source/WebCore/html/HTMLElement.cpp:779
> +    dispatchSimulatedClick(0, sendToAnyElement);

I don't understand why we're passing sendToAnyElement to the second argument of dispatchSimulatedClick. Could you elaborate on why we do this?
Comment 40 Ryosuke Niwa 2011-11-17 23:16:14 PST
Comment on attachment 115586 [details]
fixing faling test

View in context: https://bugs.webkit.org/attachment.cgi?id=115586&action=review

> Source/WebCore/html/HTMLElement.cpp:777
>  void HTMLElement::accessKeyAction(bool sendToAnyElement)

Per IRC discussion, we should rename this argument to sendMouseEvents or sendMouseDownAndMouseUp. r- because we definitely don't want to land the patch as is.

> LayoutTests/fast/forms/access-key-for-all-elements.html:31
> +    testElement.onclick = function () { debug(testElement.tagName + ' element was clicked.') };
> +    testElement.onfocus = function () { debug(testElement.tagName + ' element was focused.') };

Instead of using debug here. You can do something like:

var clicked = false;
testElement.onclick = function () { clicked = true; }
var focused = false;
testElement.onclick = function () { focused = true; }

shouldBe("pressKey(testElement.accessKey);[clicked, focused]", expected_value);

where expected_value is specific to each tagName.
Comment 41 Vineet Chaudhary (vineetc) 2011-11-18 03:12:43 PST
Created attachment 115776 [details]
Updated Patch

(In reply to comment #40)
> (From update of attachment 115586 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=115586&action=review
> 
> > Source/WebCore/html/HTMLElement.cpp:777
> >  void HTMLElement::accessKeyAction(bool sendToAnyElement)
> 
> Per IRC discussion, we should rename this argument to sendMouseEvents or sendMouseDownAndMouseUp. r- because we definitely don't want to land the patch as is.

Done!

> > LayoutTests/fast/forms/access-key-for-all-elements.html:31
> > +    testElement.onclick = function () { debug(testElement.tagName + ' element was clicked.') };
> > +    testElement.onfocus = function () { debug(testElement.tagName + ' element was focused.') };
> 
> Instead of using debug here. You can do something like:
> 
> var clicked = false;
> testElement.onclick = function () { clicked = true; }
> var focused = false;
> testElement.onclick = function () { focused = true; }
> 
> shouldBe("pressKey(testElement.accessKey);[clicked, focused]", expected_value);
> 
> where expected_value is specific to each tagName.

Done!

As per the specification http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#using-the-accesskey-attribute-on-a-label-element-to-define-a-command input, button, select.. have different behavior than other elements. eg. input element only gets focused on accessKey pressed.
To test the behavior of such elements we already have test case access-key.html. Added select and textArea to the same.
Comment 42 Vineet Chaudhary (vineetc) 2011-11-18 10:47:07 PST
Comment on attachment 115776 [details]
Updated Patch

Thanks Ryosuke!
Comment 43 Erik Arvidsson 2011-11-18 10:55:58 PST
Comment on attachment 115776 [details]
Updated Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=115776&action=review

FYI

> LayoutTests/fast/forms/access-key-for-all-elements.html:12
> +    if (navigator.userAgent.search(/\bMac OS X\b/) != -1)

if (/\bMac OS X\b/.test(navigator.userAgent))

is shorter and easier to understand

> LayoutTests/fast/forms/access-key-for-all-elements.html:42
> +<ol id="console"></ol>

remove console

or

fix the tag name. It should be div.
Comment 44 Ryosuke Niwa 2011-11-18 10:57:20 PST
Comment on attachment 115776 [details]
Updated Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=115776&action=review

>> LayoutTests/fast/forms/access-key-for-all-elements.html:42
>> +<ol id="console"></ol>
> 
> remove console
> 
> or
> 
> fix the tag name. It should be div.

Oops, I didn't catch that. cq- because of this.
Comment 45 Ryosuke Niwa 2011-11-18 10:58:15 PST
I'll replace ol by div and land manually.
Comment 46 Vineet Chaudhary (vineetc) 2011-11-18 11:54:57 PST
Created attachment 115841 [details]
patch

(In reply to comment #45)
> I'll replace ol by div and land manually.

Ryosuke, I saw your comment lately, I already prepared corrected patch.
Comment 47 WebKit Review Bot 2011-11-18 13:19:30 PST
Comment on attachment 115841 [details]
patch

Clearing flags on attachment: 115841

Committed r100805: <http://trac.webkit.org/changeset/100805>
Comment 48 WebKit Review Bot 2011-11-18 13:19:38 PST
All reviewed patches have been landed.  Closing bug.
Comment 49 Timothy Hatcher 2011-11-18 13:43:05 PST
This change adds accessKey to DOMHTMLElement without the proper WebKit version availability macro. It really should have AVAILABLE_WEBKIT_VERSION_5_1_AND_LATER (which hasn't been defined yet in WebKitAvailability.h).

And accessKey should likely stay on the other subclasses to indicate it was available in older releases.
Comment 50 mitz 2011-11-18 13:44:36 PST
(In reply to comment #49)
> This change adds accessKey to DOMHTMLElement without the proper WebKit version availability macro. It really should have AVAILABLE_WEBKIT_VERSION_5_1_AND_LATER (which hasn't been defined yet in WebKitAvailability.h).
> 
> And accessKey should likely stay on the other subclasses to indicate it was available in older releases.

Filed bug 72756.