Bug 47463

Summary: autocomplete=off prevents refilling form fields on back/forward navigation
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, arv, beidson, jhawkins, ojan, sullivan, tkent, tony
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch tony: review+

Alexey Proskuryakov
Reported 2010-10-09 22:02:16 PDT
Steps to reproduce: 1. Go to https://bugs.webkit.org/query.cgi 2. Enter an e-mail address in "Email Addresses and Bug Numbers", e.g. in "assigned to" field. 3. Press Enter. 4. Press Back. Results: there is no e-mail address there any more. I think that this regressed when e-mail address autocompletion was added.
Attachments
Patch (2.01 KB, patch)
2011-02-23 00:21 PST, Ojan Vafai
tony: review+
Alexey Proskuryakov
Comment 1 2010-12-21 11:50:56 PST
This is still causing trouble for me, almost daily.
Adam Barth
Comment 2 2010-12-22 00:38:04 PST
Maybe Ojan has some insight into this issue?
Ojan Vafai
Comment 3 2010-12-29 07:31:13 PST
When you focus an email input field, the JS code sets autocomplete=off to avoid getting the browser built-in dropdown. I just did a quick test, apparently that disables the autofill behavior on back. So, that's certainly the cause. Is there another way to disable the browser dropdown? Can't preventDefault because that would also prevent inserting the character.
Alexey Proskuryakov
Comment 4 2011-01-13 21:38:41 PST
I don't know the answer to your question. However, - is it a bug that autocomplete=off disables restoring form state on back/forward? - why doesn't the Bugzilla advanced search page go into b/f cache at least?
Ojan Vafai
Comment 5 2011-01-14 09:01:50 PST
Erik, do you know if there's a way to make this work, i.e., to avoid the browser dropdown when typing in an input, but keep the autofill behavior when going back?
Erik Arvidsson
Comment 6 2011-01-18 11:13:49 PST
(In reply to comment #5) > Erik, do you know if there's a way to make this work, i.e., to avoid the browser dropdown when typing in an input, but keep the autofill behavior when going back? I don't know if there is another way to prevent the drop down but it seems wrong to not restore the input states when going back to a page. I don't see why autofill should be related to that behavior.
Ojan Vafai
Comment 7 2011-01-18 11:22:59 PST
Sounds like that's the bug to me. Who knows about form filling that we can CC here to confirm?
Kent Tamura
Comment 8 2011-01-18 16:23:54 PST
This behavior for autocomplete is a part of fixing Bug 23346. I don't remember the specific reason for autocomplete...
Alexey Proskuryakov
Comment 9 2011-02-14 09:57:43 PST
Could we perhaps remove autocomplete from these fields as a temporary measure?
Brady Eidson
Comment 10 2011-02-14 10:08:05 PST
(In reply to comment #4) > I don't know the answer to your question. However, > - is it a bug that autocomplete=off disables restoring form state on back/forward? No, it is not a bug. It is intentional. Banks require that autocomplete=off means no form restoration on back/forward.
Ojan Vafai
Comment 11 2011-02-17 00:37:26 PST
(In reply to comment #9) > Could we perhaps remove autocomplete from these fields as a temporary measure? You mean turn off email autocomplete entirely or remove the autocomplete property? If you mean the latter, then it doesn't work very well because both the custom autocomplete and the browser's autocomplete menus show up. When the browser's menu is up, the custom menu doesn't function. I see a few options: 1. Go back to using browser extensions to enable autocomplete. 2. Use browser extensions to disable the custom autocomplete. 3. Add a new attribute that disables to browser autocomplete dropdown, but not formfill on page load. If someone is willing to do the work, 3 seems best since this it's likely other web developers will want it.
Alexey Proskuryakov
Comment 12 2011-02-17 01:38:17 PST
I've been thinking of returning to built-in Bugzilla behavior for these two fields only. Personally, I see huge benefit from the new autocomplete when adding people to CC list. In advanced search, I'm more likely to know e-mail address (or a sufficient part of it) for the person upfront.
Ojan Vafai
Comment 13 2011-02-17 21:02:20 PST
(In reply to comment #12) > I've been thinking of returning to built-in Bugzilla behavior for these two fields only. Personally, I see huge benefit from the new autocomplete when adding people to CC list. In advanced search, I'm more likely to know e-mail address (or a sufficient part of it) for the person upfront. That certainly doesn't match my experience, but I don't feel strongly either way.
Tony Chang
Comment 14 2011-02-22 10:26:14 PST
Can we just re-enable autocomplete on form submit? Here's an example that turns off autocomplete on focus, but re-enables it on submit. It seems to remember the form contents when I press back. http://ponderer.org/tests/form-autocomplete.html
Ojan Vafai
Comment 15 2011-02-23 00:14:24 PST
Yeah. That seems to work. So really, we just need to add the following to where we set autocomplete="off": input.form.addEventListener("submit", function() { input.setAttribute("autocomplete", "on"); }, false);
Ojan Vafai
Comment 16 2011-02-23 00:21:38 PST
Ojan Vafai
Comment 17 2011-02-23 20:22:17 PST
Ojan Vafai
Comment 18 2011-02-23 20:33:26 PST
Yay, it works!
Alexey Proskuryakov
Comment 19 2011-02-23 20:37:58 PST
Thank you thank you thank you!!!
Note You need to log in before you can comment on or make changes to this bug.