Bug 200834

Summary: The default tab index of output and fieldset should be -1
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: DOMAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, ryanhaddad, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
URL: https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
Bug Depends on:    
Bug Blocks: 199606    
Attachments:
Description Flags
Fixes the bug achristensen: review+

Description Ryosuke Niwa 2019-08-16 15:08:31 PDT
According to the latest HTML specification, the default tab index of output, fieldset, and keygen should be -1.
This is also the behavior of Chrome & Firefox.
Comment 2 Ryosuke Niwa 2019-08-16 16:39:02 PDT
Apparently keygen had been dropped from the standard and other browser have removed it.
Comment 3 Ryosuke Niwa 2019-08-16 16:49:17 PDT
Created attachment 376568 [details]
Fixes the bug
Comment 4 Alex Christensen 2019-08-19 10:48:41 PDT
Comment on attachment 376568 [details]
Fixes the bug

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

> Source/WebCore/ChangeLog:35
> +        Test: fast/dom/tabindex-defaults.html

No web platform test?

> Source/WebCore/html/HTMLButtonElement.h:54
> +    int defaultTabIndex() const;

Should this be "override" or "final"?

> Source/WebCore/html/HTMLTextAreaElement.h:116
> +    int defaultTabIndex() const;

ditto.
Comment 5 Ryosuke Niwa 2019-08-20 12:43:16 PDT
Comment on attachment 376568 [details]
Fixes the bug

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

>> Source/WebCore/ChangeLog:35
>> +        Test: fast/dom/tabindex-defaults.html
> 
> No web platform test?

There is one test upstream but they don't test output and fieldset.

>> Source/WebCore/html/HTMLButtonElement.h:54
>> +    int defaultTabIndex() const;
> 
> Should this be "override" or "final"?

Yes. Fixed to be final.

>> Source/WebCore/html/HTMLTextAreaElement.h:116
>> +    int defaultTabIndex() const;
> 
> ditto.

Also fixed.
Comment 6 Ryosuke Niwa 2019-08-20 12:59:02 PDT
Committed r248914: <https://trac.webkit.org/changeset/248914>
Comment 7 Radar WebKit Bug Importer 2019-08-20 12:59:18 PDT
<rdar://problem/54524545>
Comment 8 Ryan Haddad 2019-08-20 17:01:06 PDT
(In reply to Ryosuke Niwa from comment #6)
> Committed r248914: <https://trac.webkit.org/changeset/248914>

imported/w3c/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlformcontrolscollection.html is failing after this change

--- /Volumes/Data/slave/mojave-release-tests-wk2/build/layout-test-results/imported/w3c/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlformcontrolscollection-expected.txt
+++ /Volumes/Data/slave/mojave-release-tests-wk2/build/layout-test-results/imported/w3c/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlformcontrolscollection-actual.txt
@@ -1,5 +1,5 @@
 
-PASS The length attribute must return the number of elements in the form 
+FAIL The length attribute must return the number of elements in the form assert_equals: The length attribute is incorrect. expected 1 but got 2
 PASS HTMLFormControlsCollection.item(index) must return the indexed item 
 PASS HTMLFormControlsCollection[index] must return the indexed item 
 PASS HTMLFormControlsCollection is not callable 
@@ -10,6 +10,7 @@
 PASS The namedItem(name) must return null if the name is empty 
 PASS The namedItem(name) must return null if there is no matched element 
 PASS Controls can be indexed by id or name attribute 
+FAIL Keygen controls do not show up at all assert_equals: Keygen does not show up when queried by id. expected null but got Element node <keygen id="kg" name="key"></keygen>
 PASS The namedItem(name) must return the items with id or name attribute 
 PASS The HTMLFormControlsCollection interface is used for collections of listed elements in form element 
 PASS The HTMLFormControlsCollection interface is used for collections of listed elements in fieldset element
Comment 9 Ryosuke Niwa 2019-08-20 17:04:47 PDT
(In reply to Ryan Haddad from comment #8)
> (In reply to Ryosuke Niwa from comment #6)
> > Committed r248914: <https://trac.webkit.org/changeset/248914>
> 
> imported/w3c/web-platform-tests/html/infrastructure/common-dom-interfaces/
> collections/htmlformcontrolscollection.html is failing after this change
> 
> ---
> /Volumes/Data/slave/mojave-release-tests-wk2/build/layout-test-results/
> imported/w3c/web-platform-tests/html/infrastructure/common-dom-interfaces/
> collections/htmlformcontrolscollection-expected.txt
> +++
> /Volumes/Data/slave/mojave-release-tests-wk2/build/layout-test-results/
> imported/w3c/web-platform-tests/html/infrastructure/common-dom-interfaces/
> collections/htmlformcontrolscollection-actual.txt
> @@ -1,5 +1,5 @@
>  
> -PASS The length attribute must return the number of elements in the form 
> +FAIL The length attribute must return the number of elements in the form
> assert_equals: The length attribute is incorrect. expected 1 but got 2
>  PASS HTMLFormControlsCollection.item(index) must return the indexed item 
>  PASS HTMLFormControlsCollection[index] must return the indexed item 
>  PASS HTMLFormControlsCollection is not callable 
> @@ -10,6 +10,7 @@
>  PASS The namedItem(name) must return null if the name is empty 
>  PASS The namedItem(name) must return null if there is no matched element 
>  PASS Controls can be indexed by id or name attribute 
> +FAIL Keygen controls do not show up at all assert_equals: Keygen does not
> show up when queried by id. expected null but got Element node <keygen
> id="kg" name="key"></keygen>
>  PASS The namedItem(name) must return the items with id or name attribute 
>  PASS The HTMLFormControlsCollection interface is used for collections of
> listed elements in form element 
>  PASS The HTMLFormControlsCollection interface is used for collections of
> listed elements in fieldset element

Ugh... my commit had a superfluous change to LayoutTests/imported/w3c/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlformcontrolscollection.html. Reverting the test change now.
Comment 10 Ryosuke Niwa 2019-08-20 17:10:13 PDT
Fixed in https://trac.webkit.org/changeset/248924.