Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete on Login doesn't work with sl-input type="password" #1205

Closed
idna001 opened this issue Feb 20, 2023 · 5 comments
Closed

Autocomplete on Login doesn't work with sl-input type="password" #1205

idna001 opened this issue Feb 20, 2023 · 5 comments
Assignees
Labels
bug Things that aren't working right in the library.

Comments

@idna001
Copy link

idna001 commented Feb 20, 2023

I have noticed a strange behavior with the sl-input type=password.
When I set the input with the autocomplete attribute, the same autocomplete attribute is added to the shadow root for other types.
But not with the type="password". Here the default is always set to "autocomplete=off" and so Safari key pass or Firefox don't fill the login data automatically.

I'm not quite sure if there is an actual bug, but I see that browsers don't recognize my sl-inputs as the native inputs

To Reproduce:

Set your password input in your login form to autocomplete="current-password"

After the first log in (and given password) the browser should ask for "Save password" and use it in future - this doesn't happen.

Screenshots

Here is an example of a login screen. The first email input is correct, also in the shadow root.
The second password input is correct with autocomplete, but in the shadow root the attribute is not used.
sl-input

Browser / OS

  • OS: [Mac, Windows]
  • Browser: [Firefox, Safari]
  • Browser version: [111, 16.1]
@idna001 idna001 added the bug Things that aren't working right in the library. label Feb 20, 2023
@Antony92
Copy link

Antony92 commented Feb 20, 2023

Looking at the code it seems that for input type password it is always set to 'off'. Not sure why maybe there is a good reason behind it. @claviska

autocomplete=${ifDefined(this.type === 'password' ? 'off' : this.autocomplete)}

Also a quick read MDN (most browsers will still autocomplete it even if it is off)

@claviska
Copy link
Member

I remember adding this check for autocapitalize, autocomplete, and autocorrect early on to make iOS not automatically capitalize and such. It probably shouldn't have been on autocomplete in the first place and may have been a copy/paste error.

I've fixed that and also removed this check from the other two values, since they made it impossible to customize the values. This bug may affect the default values, but setting them to off will restore the previous behavior.

Fixed in 5b12de1. This will be available in the next releast.

@idna001
Copy link
Author

idna001 commented Feb 22, 2023

Great, thank you for fixing and explanation. 😄

@idna001
Copy link
Author

idna001 commented Mar 23, 2023

I thought that it was because of the missing attribute.
But I tested my login form now again with the new release of Shoelace, but in Safari and Firefox Dev Edition autocomplete still doesn’t work.

Maybe it has something to do with that Issue #1221. In Chrome autocomplete works just fine.

Here is an Overview of my tests:

Browser Shoelace One Click Autofill Shoelace Autofill Click in every Input
Firefox 111
Firefox Dev 111
Safari 16
Chrome 111

@claviska
Copy link
Member

Sadly, I think that's exactly what it is. Please follow #1221 to track progress as things evolve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that aren't working right in the library.
Projects
None yet
Development

No branches or pull requests

3 participants