Allow No Initial Selection in XUL MenuList
Categories
(Toolkit :: UI Widgets, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox125 | --- | fixed |
People
(Reporter: nordzilla, Assigned: nordzilla)
References
Details
Attachments
(1 file)
Problem Description
The XUL MozMenuList implementation has a setInitialSelection() implementation.
It gets called here in menulist.js.
I have a use case for the Select Translations Panel in which I want to leave the menulist with no item selected, such as requesting a translation from a language that we do not yet support. There is no valid value that the menulist should have in this case.
Proposal
I would like to add a way to allow menulists to remain unselected when initialized. This should be a non-breaking change, and an opt-in experience.
My initial approach is to check for an attribute noinitialselection="true"
(similar to noautofocus) in which case the menulist will not default to selecting one of the values when initialized.
But I'm certainly open to feedback on other approaches to solve this problem.
Example
<panel>
<menulist value="" label="None" noinitialselection="true">
<menupopup>
<menuitem value="1" label="One"/>
<menuitem value="2" label="Two"/>
<menuitem value="3" label="Three"/>
</menupopup>
</menulist>
</panel>
setInitialSelection() {
if (this.getAttribute("noinitialselection") === "true") {
return;
}
// Snip...
}
Assignee | ||
Comment 1•7 months ago
|
||
Allows XUL MenuList to have no selected value if
the noinitialselection attribute is specified.
Assignee | ||
Updated•7 months ago
|
Updated•7 months ago
|
Assignee | ||
Updated•7 months ago
|
Comment 3•7 months ago
|
||
bugherder |
Description
•