Open Bug 1649592 Opened 5 years ago Updated 5 years ago

Clicking on a <label> should not put the focus on a hidden input

Categories

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

77 Branch
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:

  1. 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>

  1. 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.

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.

Component: Untriaged → DOM: UI Events & Focus Handling
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Has STR: --- → yes
Ever confirmed: true
Keywords: regression
Keywords: regression

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

Has Regression Range: --- → yes
Regressed by: 1514040
Keywords: regression
Severity: -- → S3
You need to log in before you can comment on or make changes to this bug.