Inherit "form" attribute into moz- input elements when set
Categories
(Toolkit :: UI Widgets, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox147 | --- | fixed |
People
(Reporter: Gijs, Assigned: tgiles)
References
(Blocks 1 open bug)
Details
(Whiteboard: [recomp])
Attachments
(3 files)
Folks want to use moz-checkbox and moz-radio-group and such with HTML <form> elements and sometimes that requires using a form attribute (if the input isn't a descendant of the relevant form element). But the attribute needs to be on the actual <input> and so the custom element should ideally forward the one set on the custom element to the nested <input>.
| Reporter | ||
Comment 1•7 months ago
|
||
See https://phabricator.services.mozilla.com/D265895#inline-1456964 where I originally tried to suggest we use moz-checkbox, only we can't...
| Assignee | ||
Updated•7 months ago
|
Updated•7 months ago
|
| Assignee | ||
Comment 2•7 months ago
|
||
I'm hoping this is as straightforward as adding the static formAssociated = true; to the various base input elements we have. If not, I'll write up my findings so we can figure out how to best solve this.
Updated•7 months ago
|
Updated•7 months ago
|
| Assignee | ||
Comment 3•7 months ago
|
||
By utilizing the static formAssociated property, we allow elements
that extend the MozBaseInputElement to work as expected when used in
form elements. Since we are changing the base input element to be a
form-associated element, we have to implement some additional functions
that are common to form elements. These are the form() getter, the
public setFormValue method, and the public formResetCallback method.
The setFormValue is a public method because we need subclasses of the
base input element to be able to modify the private internals of the
base input class.
| Assignee | ||
Comment 4•7 months ago
|
||
We need to override the public setFormValue and formResetCallback
methods of the base input element for moz-checkbox to behave as expected
in forms.
| Assignee | ||
Comment 5•7 months ago
|
||
In order for moz-radio-group to behave correctly when used in a form, we
needed to add the formAssociated property to the SelectControl class
and implement setFormValue and formResetCallback.
Comment 8•6 months ago
|
||
Reverted this because it was causing mochitests failures in test_moz_checkbox.html.
- Revert link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | toolkit/content/tests/widgets/test_moz_checkbox.html | The nested moz-checkbox element is enabled when the parent input is activated. - got true, expected false
Please also check this failure.
| Assignee | ||
Comment 9•6 months ago
|
||
Fixed the test failures and queued up a new landing. We'll see if it sticks this time.
Comment 10•6 months ago
|
||
Comment 11•6 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/991bfd884424
https://hg.mozilla.org/mozilla-central/rev/a673acb3100c
https://hg.mozilla.org/mozilla-central/rev/4e766b162215
Updated•5 months ago
|
Description
•