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

Issue 856664 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature



Sign in to add a comment

Improving max_length for autofill

Project Member Reported by battre@chromium.org, Jun 26 2018

Issue description

In form_autofill_util.cc / WebFormControlElementToFormField() we copy the maxlength attribute into FormFieldData.

In practice a number of sites seem to rely on data-val-length-max which is used by jQuery for form validation. Maybe we should consider that value as well.

I noticed this when looking at requirements for password generation.
 

Comment 1 by battre@chromium.org, Jun 26 2018

Example for testing https://www.cryptopia.co.nz/Login/Register

Comment 2 Deleted

Comment 3 by wahaha...@gmail.com, Jun 27 2018


Hello,
I'm interesting in solving this!

But I'm wondering how to do this.

Should I create a new member variable for FormFieldData like:

  field->data_val_length_max = data_val_length_max;


Or compare it between max_length and then copy the max or min like:

  field->max_length = MaxOrMin(input_element->MaxLength(), data_val_length_max)

Comment 4 by se...@chromium.org, Jun 27 2018

Cc: se...@chromium.org battre@chromium.org
This is pretty interesting! We've seen a number of cases where the maxlength would be 12 but the site would truncate to 10 for example.

I think in general keeping the smallest is what would be most useful to us, at least for Autofill. My only worry is the quality of that data. For example, I would't want to override a maxlength of 10 with a data_val_... of 0. I really don't know if that happens in the wild though.

battre@ do you have a preference in regards to Password Generation?

Comment 5 by battre@chromium.org, Jun 29 2018

Cc: nepper@chromium.org
Yes, I was also thinking of keeping the smallest for password generation.

My thought was to go with field->max_length = Min(input_element->MaxLength(), data_val_length_max) but you raise a good point about abuse. WDYT? Should we go for field->data_val_length_max = data_val_length_max;?

+nepper as this is would lead to a user facing change.
Could we crowdsource this value (the length of data most people enter)? It would solve a lot of cases.

Another common one is setting autocomplete="cc-exp" (MM/YYYY) but in reality expecting MM/YY. Autofill will only do the right thing if the website sets maxlength="5".

Comment 7 Deleted

Comment 8 Deleted

Crowdsourcing is another interesting approach. +rogerm@ for his thoughts on that.

Sign in to add a comment