Closed Bug 1128054 Opened 9 years ago Closed 4 years ago

invalid tabindex value makes element focusable

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

35 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: mail, Assigned: edgar)

References

()

Details

Attachments

(4 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:35.0) Gecko/20100101 Firefox/35.0
Build ID: 20150108202552

Steps to reproduce:

create the element <span tabindex="hello">...</span> and tried to focus it


Actual results:

the element with an obviously invalid tabindex was focused.


Expected results:

nothing, as the element should not be focusable
when using it on an element who is not focusable by default like span element it become only focusable on click but when using it on <a> without ahref it becomme focusable on click and keyboard navigation.
Furthermore there is the same problem when using tabindex with any value at all example :
<span tabindex>...</span>

Live example : https://jsfiddle.net/pxxnx9pc/
From [1] it's clear that an non-integer (and thus invalid) "tabindex" value should be the same
than an unspecified value.


Currently it's like tabindex=0 for links/buttons/likely others and tabindex=-1 otherwise.


[1] http://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute
Component: Untriaged → Event Handling
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true
Component: Event Handling → User events and focus handling
Assignee: nobody → echen

Instead of checking node name in nsGenericHTMLElement.

Given that the Element::TabIndexDefault returns -1 already.

Depends on D68208

Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/784baedd224c
Part 1: Override IsInteractiveHTMLContent in HTMLEmbedElement; r=smaug
https://hg.mozilla.org/integration/autoland/rev/d44b8cf747e3
Part 2: Don't need to override TabIndexDefault in HTMLEmbedElement; r=smaug
https://hg.mozilla.org/integration/autoland/rev/89df17138443
Part 3: Invalid tabindex attribute should not make an element focusable; r=smaug
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/22713 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: