New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 741089 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Chrome ignores autocomplete hints when added via javascript

Reported by bigdog...@gmail.com, Jul 11 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36

Steps to reproduce the problem:
1. create a text input field that is targeted to autofill
2. add autocomplete='disable-autofill' attribute using javascript
3. observe autofill behavior on the field

What is the expected behavior?
The field would follow the autocomplete logic specified by the 'autocomplete' hint.

What went wrong?
The default autofill logic applies

Did this work before? N/A 

Chrome version: 59.0.3071.115  Channel: stable
OS Version: 10.0
Flash Version: 

If the autocomplete hint is provided as part of the HTML, the behavior is correct. But if it is added using javascript, the behavior is incorrect. Using the developer tools, inspecting the input element shows the expected attribute content but the behavior in the browser reverts to default.

---- this works ----
<form>
  <input type='text' id='name' name='name' autocomplete='disable-autofill'/>
  <input type='text' id='address' name='address' autocomplete='disable-autofill'/>
  <input type='text' id='city' name='city' autocomplete='disable-autofill'/>
  <input type='text' id='state' name='state' autocomplete='disable-autofill'/>
  <input type='text' id='zip' name='zip' autocomplete='disable-autofill'/>
</form>

---- This does not work ----
<form>
  <input type='text' id='name' name='name' />
  <input type='text' id='address' name='address' />
  <input type='text' id='city' name='city' />
  <input type='text' id='state' name='state' />
  <input type='text' id='zip' name='zip' />
</form>

var elements = document.getElementsByTagName("input")
for (var i = 0; i < elements.length; i++) {
    if(elements[i].type == "text") {
        elements[i].setAttribute("autocomplete", "disable-autofill"); 
    }
}

Even though, in the inspector, the form fields look like 
<form>
  <input type="text" id="name" name="name" autocomplete="disable-autofill">
  <input type="text" id="address" name="address" autocomplete="disable-autofill">
  <input type="text" id="city" name="city" autocomplete="disable-autofill">
  <input type="text" id="state" name="state" autocomplete="disable-autofill">
  <input type="text" id="zip" name="zip" autocomplete="disable-autofill">
</form>
 

Comment 1 by woxxom@gmail.com, Jul 11 2017

There's no "disable-autofill" value for the attribute in the specification:
https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill
Try the spec-compliant "off" value. 

Comment 2 by bigdog...@gmail.com, Jul 11 2017

See the comment in the following bug:

https://bugs.chromium.org/p/chromium/issues/detail?id=468153#c164

---- quoted text ----
As an example, if you have an address input field in your CRM tool that you don't want Chrome to Autofill, you can give it semantic meaning that makes sense relative to what you're asking for: e.g. autocomplete="new-user-street-address".  If Chrome encounters that, it won't try and autofill the field.
---- end quoted text ----

Just that, instead of using "new-user-street-address", I'm using a different value. The behavior the same - i.e. it won't work with "new-user-street-address" either.

Comment 3 by rtoy@chromium.org, Jul 11 2017

Components: -Blink UI>Browser>Autofill
Labels: Needs-Triage-M59
Cc: krajshree@chromium.org
Labels: Needs-Feedback
bigdogs30@ - Thanks for filing the issue...!!

Could you please provide a sample URL or test file to test the issue from TE-end.
This will help us in triaging the issue further.

Thanks...!!

Comment 6 by bigdog...@gmail.com, Jul 20 2017

The working and bugged code is in the original message but here are a couple of copy-pasted URLs

Working - https://jsfiddle.net/soj9m6dv/
Bugged - https://jsfiddle.net/oxgrn2kq/
Another bugged one that more closely follows the Chromium guidance from the article linked above - https://jsfiddle.net/tv69h4jv/
Project Member

Comment 7 by sheriffbot@chromium.org, Jul 20 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "krajshree@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: pnangunoori@chromium.org
Labels: Needs-Feedback
@ bigdogs30 -- Thanks for providing the sample URL’s.

But, from the URL’s provided, which is mentioned as ‘Buggy’ seems to be working and the URL’s which is mentioned as ‘Working’ seems to be not working. Attached the screen-cast of the same. Could you please check and let us know if we have missed anything.

Thanks in advance.

741089.webm
5.1 MB View Download

Comment 9 by bigdog...@gmail.com, Jul 21 2017

The URLs are correct. The behavior is that, when the auto-complete attribute is set to a value that is unrecognized by Chrome, the auto-fill functionality is suppressed. That is what the https://jsfiddle.net/soj9m6dv/ link does.

If I use JavaScript to set the auto-complete attribute to the same value as if it is hard-coded into the HTML (i.e. one unrecognized by Chrome), the auto-fill functionality should be suppressed (as in the first example) but it is not (i.e. it activates). That is what the https://jsfiddle.net/oxgrn2kq/ link does.

The third link also should suppress the auto-fill behavior but doesn't.

In short, the auto-fill behavior should be suppressed on ALL of the links provided (i.e all the links should do the same thing) but is only suppressed on the first. The video that you provided accurately demonstrates this behavior. 

To be perfectly clear, I do not want the auto-fill behavior to activate. Only the first URL accomplishes that goal although all three should.
Project Member

Comment 10 by sheriffbot@chromium.org, Jul 21 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "pnangunoori@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: se...@chromium.org
Labels: -Type-Bug -Pri-2 -Needs-Triage-M59 hasbisect-per-revision M-62 OS-Linux OS-Mac Pri-1 Type-Bug-Regression
Owner: se...@yandex-team.ru
Status: Assigned (was: Unconfirmed)
Able to reproduce the issue on Windows 10, mac 10.12.6 and Ubuntu 14.04 using chrome reported version #59.0.3071.115 and latest canary #62.0.3166.0.

Bisect Information:
=====================
Good build: 59.0.3041.0    Revision(456562)
Bad Build : 59.0.3042.0    Revision(456934)

Change Log URL: 
https://chromium.googlesource.com/chromium/src/+log/96ff8f1f6f00e57db01f58b3bbc4ee0fe3e90ee7..7eaf2657fde72f7cc64482cfb0d701bbaf34648a

From the above change log suspecting below change
Review url: https://codereview.chromium.org/2730383003

sense@ - Could you please check whether this is caused with respect to your change, if not please help us in assigning it to the right owner.

Note: ccing one of the reviewer as the owner doesn't own chromium id. 

Thanks...!!
Status: Untriaged (was: Assigned)
Status: Assigned (was: Untriaged)
This bug has an owner, thus, it's been triaged. Changing status to "assigned".

Sign in to add a comment