Keyboard navigation order of radio buttons is not guaranteed to be in tree-order
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Tracking
()
People
(Reporter: bart, Assigned: avandolder)
References
(Regressed 1 open bug, Regression)
Details
(Keywords: regression)
Attachments
(3 files)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0
Steps to reproduce:
See live test cases at http://firefox-radio-order-bug-testcase.surge.sh/ (also attached) showing buggy and working cases. See source. There is one buggy form, and two working forms, with the bug worked around in different ways.
Scenario:
I have a form element with an ID.
Before, outside this form element in DOM order are some radio controls.
Example:
<label><input type="radio" name="radio-group" value="1" form="myform">1</label>
<label><input type="radio" name="radio-group" value="2" form="myform">2</label>
...
<form id="myform"></form>
I am navigating the form with the keyboard: tab, shift-tab, and cursors.
Actual results:
The navigation order of the radio buttons when moving between them with cursor keys seems random, and is different each time I refresh the page. Tab order between radio groups is fine.
Expected results:
Predictable, logical order when navigating between radio buttons with the keyboard.
Known workarounds:
- Putting the form element before the inputs (and still referencing it with the form="formid" attribute).
- Putting the input elements inside the form tag, and not using the form="formid" attribute.
Both of these are demonstrated in the test case file.
Reporter | ||
Comment 1•2 years ago
|
||
Bug does not exist in Chrome.
Comment 2•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 3•2 years ago
|
||
I could also reproduce this issue on 114, but not on 80, I will try to find a regression window.
Updated•2 years ago
|
![]() |
||
Comment 4•2 years ago
|
||
Regression window:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=deaebc1c5c0e813b9df285903a5195f056c231a8&tochange=75e6eca97890cf3b5e4ee753daca5abae683397d
Comment 5•2 years ago
|
||
Set release status flags based on info from the regressing bug 1707126
:saschanaz, since you are the author of the regressor, bug 1707126, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
Updated•2 years ago
|
Comment 6•2 years ago
|
||
(In reply to Alice0775 White from comment #4)
Regression window:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=deaebc1c5c0e813b9df285903a5195f056c231a8&tochange=75e6eca97890cf3b5e4ee753daca5abae683397d
Thanks, Alice!
Comment 7•2 years ago
|
||
Hmm, it has been a while since I last touched radio buttons. Edgar, is this something in your current area that you can take a look? If not I can at least put it in my backlog.
Updated•2 years ago
|
Comment 8•2 years ago
|
||
Adam is working on radio group recently, maybe he has some idea.
(If not, feel free to bounce back to me)
Comment 9•2 years ago
|
||
Set release status flags based on info from the regressing bug 1707126
Assignee | ||
Comment 10•2 years ago
|
||
The issue appears to be that prior to D113589, when getting the next radio button, a form element would look up the corresponding buttons within its control collection, which had the buttons stored in order of appearance within the document. Now, however, it uses the same lookup as documents, which gets the buttons from the RadioGroupManager
s table. When the form comes after a button, the button is added to this table via a ContentChangeCallback
which is stored in an IdentifierMap
, and since iteration over a hashmap is non-deterministic, so is the order the buttons get added to the group.
It should be possible to change the callbacks to be stored in a fixed-order structure instead, so the iteration is always deterministic.
Assignee | ||
Comment 11•2 years ago
|
||
Previously, the order was non-deterministic due to the callbacks being
iterated in the order they were stored in a hashtable. This patch adds a
LinkedList over the callback entries, tracking their order of insertion
while still making them available through a hashtable.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 12•2 years ago
|
||
So it turns out this bug is actually a larger issue. Currently, no in cases is tree-order being checked during radio button navigation, and so if buttons are moved or added in between existing ones in a group, the keyboard navigation will still follow the order the elements were inserted. This occurs whether the form element comes after the inputs or not, and also if the inputs are not part of a form.
Updated•2 years ago
|
Comment 13•2 years ago
|
||
Comment 14•2 years ago
|
||
Backed out for build bustages on mochitest.ini
Backout link: https://hg.mozilla.org/integration/autoland/rev/63736f30e2c65a00bc23ba7317b581b5f9f4a53f
Log link: https://treeherder.mozilla.org/logviewer?job_id=424712302&repo=autoland&lineNumber=1106
Comment 16•2 years ago
|
||
Comment 18•2 years ago
|
||
bugherder |
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Comment 20•2 years ago
|
||
The patch landed in nightly and beta is affected.
:avandolder, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox117
towontfix
.
For more information, please visit BugBot documentation.
Assignee | ||
Updated•2 years ago
|
Updated•1 year ago
|
Description
•