input autocomplete suggestions from datalist don't show up when type attribute dynamically changed from button to text via javascript
Categories
(Toolkit :: Form Manager, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox108 | --- | fixed |
People
(Reporter: bugreport+mozilla, Assigned: issammani)
References
Details
(Keywords: testcase)
Attachments
(3 files, 2 obsolete files)
Steps to reproduce:
for input with attributes type=button and list=(id of datalist), type is dynamically changed via javascript setAttribute on button click from button to text.
Actual results:
suggestions from datalist don't show up
Expected results:
suggestions from datalist show up (as happens in safari & chrome)
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::Address Bar' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Reporter | ||
Updated•3 years ago
|
Updated•3 years ago
|
Comment 2•3 years ago
|
||
Thanks for the testcase! Over to the DOM team for further triage.
Comment 3•3 years ago
|
||
The attribute change is observed here:
https://searchfox.org/mozilla-central/rev/b72e9d7d63bf499d1d8168291b93d4ec7fde236e/toolkit/components/satchel/nsFormFillController.cpp#148-149,160
And if it's liked to a datalist
element, it'll start to autocomplete:
https://searchfox.org/mozilla-central/rev/b72e9d7d63bf499d1d8168291b93d4ec7fde236e/toolkit/components/satchel/nsFormFillController.cpp#1016,1028-1029
So anyway, this looks like a bug of autocomplete.
Comment 4•2 years ago
|
||
The severity field is not set for this bug.
:mak, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 5•2 years ago
|
||
Being in satchel this is effectively Form Manager.
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 6•2 years ago
|
||
So after further investigation, I believe two things cause this issue:
- An early return when the input field is not a text field. (https://searchfox.org/mozilla-central/source/toolkit/components/satchel/nsFormFillController.cpp#1005-1007)
- The focus state is not updated. (https://searchfox.org/mozilla-central/source/toolkit/components/satchel/nsFormFillController.cpp#1282-1283)
Since we never attach a mutation observer to the input if it's not a text input ( due to the early return ), we never pick up the change on the type
attribute. Even if we did when we change the attribute the text input is not focused. This hints that we might also be handling the focus update wrong.
N.B: I reduced the example provided by OP to only a change from text to button input on click. The unexpected behavior still persists, but if you blur and then focus again everything works as expected.
Comment 7•2 years ago
|
||
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 8•2 years ago
|
||
Assignee | ||
Comment 9•2 years ago
|
||
Depends on D155245
Assignee | ||
Comment 10•2 years ago
|
||
Depends on D155246
Comment 11•2 years ago
|
||
Comment 12•2 years ago
|
||
Backed out 3 changesets (bug 1767250) for causing mochitest plain failures in toolkit/components/satchel/test/test_datalist_attribute_change.html
Backout link: https://hg.mozilla.org/integration/autoland/rev/f4a3b649b9122ae19e42f3b966a9281b337e308b
LE. Also these android mochitest plain failures
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 14•2 years ago
|
||
There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:issammani, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit auto_nag documentation.
Assignee | ||
Comment 15•2 years ago
|
||
Sorry for the late reply. Just need to fix some tests and we should be good to go.
Comment 16•2 years ago
|
||
Comment 17•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/78fadd309a22
https://hg.mozilla.org/mozilla-central/rev/2c8ff4622a78
Updated•2 years ago
|
Description
•