Skip to content

Conversation

@brianteeman
Copy link
Contributor

Pull request for #26459

The docblock in all fields is wrong

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

All we ever do is see if it is "on" or "off"

For example

!$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"

This PR allows for the correct usage of the autocomplete element so that it supports all element values.

Testing is super simple. Apply the PR and then edit or add an autocomplete element to any field xml and see what is generated in the source

Pull request for joomla#26459

Unless I am missing something then this docblock in all fields is wrong
https://github.com/joomla/joomla-cms/blob/bc42bb1e43d96334c38222dbe49b83f898413f2a/layouts/joomla/form/field/password.php#L20

All we ever do is this
https://github.com/joomla/joomla-cms/blob/bc42bb1e43d96334c38222dbe49b83f898413f2a/layouts/joomla/form/field/password.php#L72

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.

https://github.com/joomla/joomla-cms/blob/bc42bb1e43d96334c38222dbe49b83f898413f2a/administrator/components/com_users/forms/user.xml#L20-L30

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
@Quy
Copy link
Contributor

Quy commented Oct 4, 2019

I have tested this item ✅ successfully on 3886e84


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

1 similar comment
@bembelimen
Copy link
Contributor

I have tested this item ✅ successfully on 3886e84


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

@alikon
Copy link
Contributor

alikon commented Oct 5, 2019

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Oct 5, 2019
@wilsonge wilsonge merged commit fcdf506 into joomla:4.0-dev Oct 6, 2019
@wilsonge
Copy link
Contributor

wilsonge commented Oct 6, 2019

Thanks!

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Oct 6, 2019
@wilsonge wilsonge added this to the Joomla 4.0 milestone Oct 6, 2019
@brianteeman
Copy link
Contributor Author

Thanks

@brianteeman brianteeman deleted the password branch October 6, 2019 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants