Picker is inaccessible to keyboard and screen reader users when showPicker is used on datalist
Categories
(Core :: DOM: Forms, defect, P2)
Tracking
()
People
(Reporter: Jamie, Assigned: edgar)
References
Details
(Keywords: access)
Attachments
(2 external files)
STR:
- Open this test case:
data:text/html,<input id="inp" list="dl"><datalist id="dl"><option>a</option><option>b</option></datalist><button onclick="inp.showPicker();">Show - Tab to the Show button.
- Press space to activate it.
- Press down arrow to move through the datalist items.
- Expected: Datalist items should be selected.
- Actual: Nothing happens.
- Press escape to dismiss the picker.
- Expected: The picker should be dismissed.
- Actual: Nothing happens.
In addition, nothing is reported to a screen reader.
This makes a picker shown in this way completely inaccessible to keyboard and screen reader users.
| Assignee | ||
Comment 1•1 year ago
|
||
The keyboard navigation on the drop down works only when the input element receives the keyboard event (which means the input element need to have the focus), but currently spec doesn't mention we need to move the focus to the input element while showPicker() is called, other browsers doesn't move the focus, either. But Chrome can still do keyboard navigation on the dropdown while the focus isn't on the input element.
| Reporter | ||
Comment 2•1 year ago
|
||
(In reply to Edgar Chen [:edgar] from comment #1)
currently spec doesn't mention we need to move the focus to the input element while
showPicker()is called, other browsers doesn't move the focus, either.
Just for reference (I'm aware you already know this), there's an open issue against the spec regarding showPicker moving focus to the element, as it has other benefits too: https://github.com/whatwg/html/issues/9757
Comment 3•1 year ago
|
||
It's a shipping blocker for bug 1998668; we decided to hold off the feature shipping to release which will reduce the severity impact, so I mark this as S3.
| Reporter | ||
Comment 4•1 year ago
•
|
||
I'm leaving accessibility severity as s2 just so we don't understate the importance for accessibility here. BugBot will probably shortly nag to escalate this to s2 because of this mismatch, but this can just be ignored, as we have a clear plan to fix this before we ship it.
Well, if that moves focus and blur the control causes closing the picker, we should be careful about focus/blur loop.
| Reporter | ||
Comment 6•1 year ago
|
||
(In reply to Edgar Chen [:edgar] from comment #1)
But Chrome can still do keyboard navigation on the dropdown while the focus isn't on the input element.
One problem with not focusing the input for screen reader users is that when the picker first opens, nothing will be reported, since no item is selected yet. Since the input isn't focused, we can't fire an expanded state change or similar on the input to notify the user that a picker has appeared (but nothing is selected yet). Thus, a screen reader will have to jump through hoops to select the first item in the picker, since the screen reader isn't aware that the picker even opened. We might be able to fire focus on the menupopup to get around this, but we only want to do that if showPicker is called, not if the picker appeared for some other reason. I'm not sure how we can detect that yet.
Comment 7•1 year ago
|
||
The severity field for this bug is set to S3. However, the accessibility severity is higher, .
:masayuki, could you consider increasing the severity?
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 9•1 year ago
|
||
(In reply to James Teh [:Jamie] from comment #6)
One problem with not focusing the input for screen reader users is that when the picker first opens, nothing will be reported, since no item is selected yet. Since the input isn't focused, we can't fire an expanded state change or similar on the input to notify the user that a picker has appeared (but nothing is selected yet).
Hi :Jamie, <select> element also supports showPicker() which won't switch focus to it while opening the drop down, e.g. data:text/html,<select id="sel"><option>a</option><option>b</option></select><button onclick="sel.showPicker();">Show</button>. Do we have similar issue for screen reader users? Or perhaps it doesn't because there is a default option is selected while drop down is opened?
| Reporter | ||
Comment 10•1 year ago
|
||
(In reply to Edgar Chen [:edgar] from comment #9)
<select>element also supportsshowPicker()which won't switch focus to it while opening the drop down ...
Do we have similar issue for screen reader users? Or perhaps it doesn't because there is a default option is selected while drop down is opened?
There's no problem with this case. As you noted, it's okay because we select an option, so that option gets "focus" for accessibility purposes.
| Assignee | ||
Updated•10 months ago
|
| Assignee | ||
Comment 11•10 months ago
|
||
This is for accessibility purposes, since the dropdown can be opened even when
the input is not focused via input.showPicker(). We should make the keyboard
navigation works for screen read users.
And the first item is also selected by default for such case, so a DOMMenuItemActive
is dispatched to notifiy the a11y that the dropdow has been opened.
| Assignee | ||
Comment 12•10 months ago
|
||
Hi :Jamie, per offline discussion, this is the patch that makes keyboard navigation working when input element isn't focused, and also the first item is selected by default, so the a11y should be notified. Could you help to check whether this works from a11y side? Thanks!
| Reporter | ||
Comment 13•10 months ago
|
||
Following the steps in comment 0, this works well with NVDA on Windows. Thank you!
Updated•10 months ago
|
Comment 14•10 months ago
|
||
Comment 15•10 months ago
|
||
Comment 16•10 months ago
|
||
Backed out for causing mochitest failures
- Backout link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | toolkit/components/satchel/test/test_datalist_showPicker.html | SecurityError: HTMLInputElement.showPicker: Call was blocked because the current origin isn't same-origin with top. - Should not throw any errors
Comment 17•10 months ago
|
||
| Assignee | ||
Updated•10 months ago
|
Comment 18•10 months ago
|
||
| bugherder | ||
Comment 19•10 months ago
|
||
Comment 20•10 months ago
|
||
Backed out for causing frequent bc failures on browser_autocomplete_import.js and browser_autocomplete_footer.js
Comment 21•10 months ago
|
||
Backout merged to central: https://hg.mozilla.org/mozilla-central/rev/a9fa59ce4077
Updated•10 months ago
|
Comment 22•10 months ago
|
||
The bug is marked as tracked for firefox149 (nightly). However, the bug still has low severity.
:hsinyi, could you please increase the severity for this tracked bug? If you disagree with the tracking decision, please talk with the release managers.
For more information, please visit BugBot documentation.
Comment 23•10 months ago
|
||
(In reply to BugBot [:suhaib / :marco/ :calixte] from comment #22)
The bug is marked as tracked for firefox149 (nightly). However, the bug still has low severity.
:hsinyi, could you please increase the severity for this tracked bug? If you disagree with the tracking decision, please talk with the release managers.
For more information, please visit BugBot documentation.
given we are shipping the feature to release in F x 149, it makes to set this as S2, aligned with the 149-tracking flag.
| Assignee | ||
Comment 24•10 months ago
|
||
After some investigation, the synthesized mouse event isn't dispatched to the dropdown item, but underlying <browser> element. I don't see how this is affected by this patch. Maybe just a existing timing problem but somehow this patch make it worse? Anyway, I guess we could try to wait for rendering a bit and then synthesize mouse event, here is a try run, lets see if it helps.
| Assignee | ||
Comment 25•10 months ago
|
||
Comment 26•10 months ago
|
||
| Assignee | ||
Updated•10 months ago
|
Comment 27•10 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/afdd62da05b3
https://hg.mozilla.org/mozilla-central/rev/9988d8db7fef
Updated•9 months ago
|
Updated•9 months ago
|
Comment 28•9 months ago
|
||
Reproducible on a 2025-11-06 Firefox Nightly build on Windows 10.
Verified as fixed on Firefox Nightly 150.0a1 and Firefox 149.0b4 on Windows 10, Ubuntu 22, macOS 15.
Description
•