Single-line text fields do not work with auto-filled form fields
See original GitHub issueI tried detecting this via change events which didn’t work. I also tried checking for value
on init but that only worked for non-password inputs and was non-deterministic in terms of its timing.
Possible workarounds:
Style for :autofill
This is clearly the most elegant solution, but looks like it’s Chrome only
Have elements poll to check if they’re auto-filled
This will lead to the highest design fidelity, but is extremely inefficient and will incur a significant performance impact, especially on mobile browsers.
Tell users to set autocomplete="off"
This would in theory solve the problem. However, it is not only an inconvenience to the user, but it’s not guaranteed to work correctly for all types of input.
Tell users to only use JS-enhanced single-line inputs with form fields that won’t be auto-completed
😢
Copied from https://github.com/google/material-design-lite/issues/4827
- Summarize research on how most browsers handle auto-filling and present best solution
- Implement solution
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:10 (9 by maintainers)
Top Results From Across the Web
Autofill populating wrong fields - Stack Overflow
It just wanted to fill any kind of field (select or input) as long it was not readonly (with complete no respect for...
Read more >Auto-populate form fields with a query string
Learn how to auto-populate field values in a form on a page by adding query strings to the page URL.
Read more >Autofill - web.dev
One way to help users fill out forms faster is by offering them the option to automatically fill in form fields with previously...
Read more >How to autopopulate the single line text field fro... - ServiceNow
I tried with the following 2 scripts but still its not working. Plz hlp me with this . script 1:- function onChange(control, oldValue,...
Read more >Disabling Safari AutoFill for a single line address input
Currently, no browser AutoFill can neatly concatenate multiple address pieces into a single input. However, the solution for these browsers is more ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@amsheehan is this fixed? i’m still getting this issue with autocomplete data
@traviskaufman After looking at the responses from the implementors of Firefox and Chrome regarding the issue of input elements not firing events for programmatic assignments of values, I don’t think we should necessarily try to force this. They seem content that since the behavior is not in the standard, that inputs should not behave this way.