Clicking on a <label> should not put the focus on a hidden input
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Tracking
()
People
(Reporter: ashley+bugzilla, Unassigned)
References
(Regression, )
Details
(Keywords: regression)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0
Steps to reproduce:
Steps to reproduce:
- Have HTML with a label with two inputs inside it. One is hidden, the other is shown, like so:
<label>
A label
<input type="date" style="display: none;" >
<input type="text">
</label>
- Click the "A label" text
Actual results:
A datepicker is shown denoting the browser put the focus on the hidden date input instead of visible text input.
Expected results:
The focus should be on the visible input and no datepicker should be shown.
Reporter | ||
Comment 1•5 years ago
|
||
Note that I've reproduced this bug on Ubuntu 18.04 and MacOS 10.13.6 both running FF 77.0.1 as well as FF mobile for Android 68.9.0. I'm happy to file another bug against the mobile app if that's preferred and y'all indeed deem this a bug ;)
If it's relevant, this issue was not reproducible in Chrome or Safari. That said, neither put the focus in the text input. Both just did not show the datepicker. Maybe a happy medium?
A work around is to re-order the inputs so the hidden one input is 2nd. The use of implicit labels seems to bind to the first input inside the tags instead of the first visible input.
![]() |
||
Updated•5 years ago
|
![]() |
||
Updated•5 years ago
|
![]() |
||
Updated•5 years ago
|
![]() |
||
Comment 2•5 years ago
|
||
Regression window:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=4b3fc8b9128035c63821078328c73fbc525d1950&tochange=6dd228164d427b7b247e59e7d9d0251206dea83d
Suspect:
6dd228164d427b7b247e59e7d9d0251206dea83d Timothy Guan-tin Chien — Bug 1514040 - Dispatch events to hidden datetimebox UA Widget r=smaug
![]() |
||
Updated•5 years ago
|
Updated•5 years ago
|
Description
•