MenuList does not deselect menu item when noinitialselection is true if value is set before connectedCallback
Categories
(Toolkit :: UI Widgets, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox126 | --- | fixed |
People
(Reporter: nordzilla, Assigned: nordzilla)
References
Details
Attachments
(2 files, 1 obsolete file)
Description
Bug 1882835 introduced an issue where a <menulist>
with noinitialselection="true"
would have its internal state reset by the connectedCallback() function if a race condition occurs in which the value is manually set before the connected callback is invoked.
This causes an issue where the external (UI) state shows the selected value, but the internal state thinks that no value is selected. In this scenario, when a new value is selected, the menu-list implementation does not realize that it should de-select the old value, because it thinks there was no value.
I didn't realize this issue until I started using it, because this race condition only occurs if a value is set before the callback is invoked, but the fix should be simple.
Steps to implement
We just need to move the two calls that reset the internal state within connectedCallback() function to instead be called within the setInitialSelection() function itself, after the optional early return.
Tests to implement
- Simulate the race condition and ensure that only one menuitem is selected after the value changes.
Assignee | ||
Updated•6 months ago
|
Assignee | ||
Comment 1•6 months ago
|
||
Fixes an issue where a no-initial-selection menulist's value
was manually set before the custom-element connectedCallback
function is invoked.
Assignee | ||
Comment 2•6 months ago
|
||
Fixes an issue where a no-initial-selection menulist's value
was manually set before the custom-element connectedCallback
function is invoked.
Depends on D204984
Updated•6 months ago
|
Updated•6 months ago
|
Pushed by enordin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/efe1e753583b Fix menulist no-initial-selection race condition r=hjones,reusable-components-reviewers
Comment 4•5 months ago
|
||
bugherder |
Description
•