Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controlled input makes browser not saving submitted value (for autocomplete) #15739

Open
bootleq opened this issue May 25, 2019 · 12 comments
Open

Comments

@bootleq
Copy link

bootleq commented May 25, 2019

Bug (behaves different per browser, but generally inconsistent to uncontrolled inputs)

Current behavior
Reproduce with https://jsfiddle.net/bootleq/hos4r6qd/

  1. Type a in name field, and b in uncontrolled field.
  2. Submit.
  3. Re-run the fiddle.
  4. Focus input fields to see if browser "saves" previous input.

Expected behavior
Browser provides a suggestion for name and b for uncontrolled field.
Controlled and uncontrolled elements should behave the same.

Actual result
Uncontrolled input has b suggestion, but controlled input (name) has no suggestion.
Tested on Windows 7, Google Chrome 74.0.3729.169.
And on Firefox 68.0b4, we can click the workaround button before submit, by reset the value DOM attribute it behaves as expected.

@anupmishra203
Copy link

Uncontrolled value saved on the window, whereas the controlled input value saved in their state.
Once the state has gone their value gone as well.

@stale
Copy link

stale bot commented Jan 10, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution.

@stale stale bot added the Resolution: Stale Automatically closed due to inactivity label Jan 10, 2020
@stale
Copy link

stale bot commented Jan 17, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

@stale stale bot closed this as completed Jan 17, 2020
@gaearon gaearon reopened this Apr 1, 2020
@stale stale bot removed the Resolution: Stale Automatically closed due to inactivity label Apr 1, 2020
@gaearon
Copy link
Collaborator

gaearon commented Apr 1, 2020

Oh wow. Good find. I guess this is also due to attribute syncing. We're going to fix this eventually but it would be a breaking change so for now let's keep it open.

@Hadsch
Copy link

Hadsch commented Jan 30, 2021

@gaearon: Are there any plans to fix this? It almost 2 years since the report and at least in my eyes this is a huge UX bug.

This bug affects other frameworks (antd, material UI):

I'm also not getting it, why this one should be a breaking change.

If autoComplete is "on" react could to this setAttribute('value', ''); under the hood and it would be fine.
Or are there any side effects if you are doing this?

@hejtmii
Copy link

hejtmii commented May 7, 2021

Same problem here

@snehabn92
Copy link

autoComplete is Not working for controlled Input.

https://jsfiddle.net/bootleq/hos4r6qd/

@handhikadj
Copy link

This also affects Formik performance, which is very bad
jaredpalmer/formik#3165

@TejSanura
Copy link

TejSanura commented Jan 11, 2022

I am not even using controlled input. Still I am facing this issue when using Firefox. I am just using input type text and the fetching the value using id on the time of submit form. Still it won't show the auto-fill suggestion box.
Anyone has any idea?
I have already kept "Remember search and form history" in Firefox settings checked.

@ahoisl
Copy link

ahoisl commented Jan 11, 2022

Just to mention that there is a "workaround" (=wild hack) we used successfully for more than a year now:
#18986 (comment)

@lindskogen
Copy link

There actually has been some activity on the Firefox side to solve this: https://bugzilla.mozilla.org/show_bug.cgi?id=1642570

It's already working in Firefox Nightly for me and seems to be scheduled for release in version 105, 2022-09-20

@lindskogen
Copy link

Tested it right now in Firefox 106.0.3 and it seems to work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

11 participants