Re: *Part* of address-line1, still use autocomplete as normal?

Hi Alan,

A quick check of the HTML5 spec (
https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute)
and I note that there is both a field identifier of "street-address" as
well as "address-line1", "address-line2", and "address-line3". When SC
1.3.5 was 'in flight' I created the following test suite to verify browser
behavior of those values. The Test suite starts here:
https://john.foliot.ca/demos/autofill.php

As I recall, the fields of address-line (1 through 3) are somewhat
dependent on how the user has stored the data in their browser. Consider
the following screenshot:
[image: image.png]
(source: Vivaldi browser on Win 11)

As I do not work for any of the browsers vendors, I cannot say for sure in
all instances, but my quick testing seems to confirm that the line break is
dependant on how the data is stored on the browser. However, because this
IS a user-feature, all browsers allow the user to modify or update their
saved address data (see this Mozilla article for Firefox:
https://support.mozilla.org/en-US/kb/automatically-fill-your-address-web-forms?as=u&utm_source=inproduct&redirectslug=automatically-fill-your-address-and-credit-card&redirectlocale=en-US
)

However, specific to your question, I suspect that if you label both inputs
with the same autocomplete value, both inputs will be 'autofilled' with the
same (identical) data - because the output is directly related to HOW the
data is stored in the browser:

[image: image.png]
(screenshot showing the autofill data  setting from Firefox, along with a
snippet of the output results from my test suite)

So, NO, I do not think "address-line1" on two inputs will give you the
results you seek, that you will instead get the identical values twice. I'd
advise (without testing) to try and use "address-line1" and "address-line2"
and test extensively. (NOTE: autocomplete is intended to be a 'service' to
the end user, and not all users will have their addresses saved. So,
recognizing that it may not always work as you want, adding "address-line1"
and "address-line2" will be the correct mark-up for conformance-sake, but
it may also result in the end user needed to go back and "tweak" what the
autocomplete autocompleted. Not perfect, but 'editing' content (essentially
removing too much content here) remains easier than having to type in all
of the data (for mobility impaired users) and/or remembering all of the
data (for some cognitively impacted users).

HTH

JF

On Wed, Jun 7, 2023 at 11:24 AM Bristow, Alan <Alan.Bristow@elections.ca>
wrote:

> Any comments appreciated re the following.
>
> SUMMARY
> If I have *two* INPUTS representing line 1 of an address, one for the
> number of a street and the other for its name, should both have an
> "autocomplete" attribute set to "address-line1"?
>
>
> DETAIL
> I am working with a legacy app that for the foreseeable future captures
> address info in a form where the fields include approximately:
>
> YOUR_STREET_NUMBER
>
> YOUR_STREET_NAME
>
> I want to tell my developers that since they need to follow "SC
> 1.3.5: Identify Input Purpose" [1] they need to use "autocomplete" on both
> INPUTS. However, while it is clear they should use "address-line1" [2] if
> there was *one* field capturing an address line such as "42 Ultimate
> Street", I am uncertain if it is still correct to use when there are two
> fields each holding only part of "line 1".
>
> I assume it *is* correct and hope current or future user-agents will work
> out what to do with the meta provided, but not being sure I thought I
> should ask here.
>
> [1]
> https://www.w3.org/WAI/WCAG22/Understanding/identify-input-purpose.html
> [2]
> https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-line1
>
> Regards,
>
> Alan
>
> . . . . -   . . - - -
> Alan Bristow ( he / him / il )
> Web Developer / Développeur Web
> Elections Canada / Élections Canada
> alan.bristow@elections.ca
>


-- 
*John Foliot* |
Senior Industry Specialist, Digital Accessibility |
W3C Accessibility Standards Contributor |

"I made this so long because I did not have time to make it shorter." -
Pascal "links go places, buttons do things"

Received on Wednesday, 7 June 2023 19:27:23 UTC