Skip to content

[4.0] $autocomplete sanity check #26459

@brianteeman

Description

@brianteeman

Unless I am missing something then this docblock in all fields is wrong

* @var string $autocomplete Autocomplete attribute for the field.

All we ever do is this

!$autocomplete ? 'autocomplete="off"' : '',

Which means that we can never have any value for autocomplete in the xml other than 'off'

You can see this by changing the value for autocomplete here to anything else and instead of the autocomplete being output with the new value it is removed.

<field
name="password"
type="password"
label="JGLOBAL_PASSWORD"
autocomplete="off"
class="validate-password-strength"
filter="raw"
validate="password"
strengthmeter="true"
force="on"
size="30"

Autocomplete has a lot of useful values that we could/should be using see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete

For example autocomplete=off really doesn't do anything on password fields. Instead we should be using autocomplete="new-password"

It looks to me that it can be fixed by changing the code to
$autocomplete ? '' : 'autocomplete="' . $autocomplete .'"',

And autocomplete is not the same as autofill

Chrome will still respect this tag for autocomplete data, it will not respect it for autofill data

But I am probably missing something
cc @HLeithner @wilsonge @mbabker

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions