Closed
Bug 1538299
Opened 6 years ago
Closed 6 years ago
currently there is no way to focus a label element from within a script
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
RESOLVED
DUPLICATE
of bug 1240285
People
(Reporter: wpirino1, Unassigned)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36
Steps to reproduce:
- I created a page with just a single label element that looks like: <label tabindex="0">Test</label>
- I ran
document.querySelector('label').focus()
- I then checked the value of
document.activeElement
Actual results:
document.activeElement was set to the body element
Expected results:
document.activeElement should have been set to the label element
Works as expected in chrome/safari. Also works as expected if you replace the label with a span or div.
Summary: focus method has unexpected effect when called on a label element with tabindex → currently there is no way to focus a label element from within a script
Updated•6 years ago
|
Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Updated•6 years ago
|
Has STR: --- → yes
Comment 1•6 years ago
|
||
As comment 1 said, span or div can be focussed by using focus() but label cannot.
If we associate a <label> with an <input> element, and try to focus it.
The input element can be focussed.
Priority: -- → P3
Updated•6 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•