Closed Bug 1767250 Opened 3 years ago Closed 2 years ago

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)

Firefox 101
Desktop
All
defect

Tracking

()

RESOLVED FIXED
108 Branch
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)

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.

Component: Untriaged → Address Bar
Component: Address Bar → General
OS: Unspecified → macOS
Hardware: Unspecified → Desktop
Status: UNCONFIRMED → NEW
Component: General → DOM: Core & HTML
Ever confirmed: true
Keywords: testcase
OS: macOS → All
Product: Firefox → Core

Thanks for the testcase! Over to the DOM team for further triage.

Component: DOM: Core & HTML → Autocomplete
Product: Core → Toolkit

The severity field is not set for this bug.
:mak, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(mak)

Being in satchel this is effectively Form Manager.

Component: Autocomplete → Form Manager
Flags: needinfo?(mak)
Severity: -- → S3
Priority: -- → P3
Flags: needinfo?(imani)

So after further investigation, I believe two things cause this issue:

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.

Flags: needinfo?(imani)
Attachment #9286461 - Attachment is obsolete: true
Assignee: nobody → imani

Depends on D155246

Pushed by imani@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/801266de7621 Reproduce bug and add test to catch it. r=sgalich https://hg.mozilla.org/integration/autoland/rev/0b5f5360e3d5 Control non-text inputs if they have a datalist. r=sgalich https://hg.mozilla.org/integration/autoland/rev/a0b66549fddc Update focus when type attribute changes. r=sgalich

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

Push with failures

Failure log

LE. Also these android mochitest plain failures

Flags: needinfo?(imani)

:smolnar looking into it !

Flags: needinfo?(imani)
Attachment #9290950 - Attachment is obsolete: true
Attachment #9290950 - Attachment is obsolete: false
Attachment #9290951 - Attachment is obsolete: true

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.

Flags: needinfo?(sgalich)
Flags: needinfo?(imani)

Sorry for the late reply. Just need to fix some tests and we should be good to go.

Flags: needinfo?(imani)
Pushed by imani@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/78fadd309a22 Reproduce bug and add test to catch it. r=sgalich https://hg.mozilla.org/integration/autoland/rev/2c8ff4622a78 Control non-text inputs if they have a datalist. r=sgalich
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
Regressions: 1816134
Flags: needinfo?(sgalich)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: