Bug 47463 - autocomplete=off prevents refilling form fields on back/forward navigation
Summary: autocomplete=off prevents refilling form fields on back/forward navigation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-09 22:02 PDT by Alexey Proskuryakov
Modified: 2011-02-23 20:37 PST (History)
8 users (show)

See Also:


Attachments
Patch (2.01 KB, patch)
2011-02-23 00:21 PST, Ojan Vafai
tony: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 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.
Comment 1 Alexey Proskuryakov 2010-12-21 11:50:56 PST
This is still causing trouble for me, almost daily.
Comment 2 Adam Barth 2010-12-22 00:38:04 PST
Maybe Ojan has some insight into this issue?
Comment 3 Ojan Vafai 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.
Comment 4 Alexey Proskuryakov 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?
Comment 5 Ojan Vafai 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?
Comment 6 Erik Arvidsson 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.
Comment 7 Ojan Vafai 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?
Comment 8 Kent Tamura 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...
Comment 9 Alexey Proskuryakov 2011-02-14 09:57:43 PST
Could we perhaps remove autocomplete from these fields as a temporary measure?
Comment 10 Brady Eidson 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.
Comment 11 Ojan Vafai 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.
Comment 12 Alexey Proskuryakov 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.
Comment 13 Ojan Vafai 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.
Comment 14 Tony Chang 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
Comment 15 Ojan Vafai 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);
Comment 16 Ojan Vafai 2011-02-23 00:21:38 PST
Created attachment 83454 [details]
Patch
Comment 17 Ojan Vafai 2011-02-23 20:22:17 PST
Committed r79515: <http://trac.webkit.org/changeset/79515>
Comment 18 Ojan Vafai 2011-02-23 20:33:26 PST
Yay, it works!
Comment 19 Alexey Proskuryakov 2011-02-23 20:37:58 PST
Thank you thank you thank you!!!