?
avatar brianteeman
brianteeman
3 Oct 2019

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

avatar brianteeman brianteeman - open - 3 Oct 2019
avatar joomla-cms-bot joomla-cms-bot - change - 3 Oct 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 3 Oct 2019
avatar brianteeman brianteeman - change - 3 Oct 2019
The description was changed
avatar brianteeman brianteeman - edited - 3 Oct 2019
avatar wilsonge
wilsonge - comment - 3 Oct 2019

Your solution sounds correct to me

avatar brianteeman
brianteeman - comment - 3 Oct 2019

And I am not missing something based on the docblock?

avatar wilsonge
wilsonge - comment - 3 Oct 2019

I think it was built to disable autocomplete on password fields back in the day. i vaguely recall buggy browser behaviour back in the early html5 browser days.

avatar wilsonge
wilsonge - comment - 3 Oct 2019

But i don't see any reason we can't expand the scope to include custom values there

avatar brianteeman
brianteeman - comment - 3 Oct 2019

It is the same in all fields not just the password field

avatar Quy Quy - close - 4 Oct 2019
avatar Quy Quy - change - 4 Oct 2019
Status New Closed
Closed_Date 0000-00-00 00:00:00 2019-10-04 11:37:03
Closed_By Quy
avatar Quy
Quy - comment - 4 Oct 2019

See PR #26467


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26459.

Add a Comment

Login with GitHub to post a comment