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

Password: Add autocomplete property for input #12362

Closed
t4keo opened this issue Dec 12, 2022 · 6 comments
Closed

Password: Add autocomplete property for input #12362

t4keo opened this issue Dec 12, 2022 · 6 comments
Labels
Type: New Feature Issue contains a new feature or new component request
Milestone

Comments

@t4keo
Copy link

t4keo commented Dec 12, 2022

Describe the feature you would like to see added

I want to use the p-password component because it’s less buggy than the directive (I just opened 2 issues) but I can’t set the "autocomplete" value directly via the component meaning that my browser think that it’s the current-password that I’m trying to set while it's the new one.
This could be avoided by adding an "inputAutocomplete" attribute to the component. This would just translate the inputAutocomplete to [attr.autocomplete]="valueOfInputAutocompleteProperty" and allow us to set it’s type so the browser knows which input means what.

Is your feature request related to a problem?

The pPassword directive is not working well and not like p-password component

Describe the solution you'd like

adding inputAutocomplete property to p-password component.

See : https://developer.mozilla.org/en/docs/Web/HTML/Attributes/autocomplete

Describe alternatives you have considered

No response

Additional context

No response

@t4keo t4keo added Status: Discussion Issue or pull request needs to be discussed by Core Team Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Type: New Feature Issue contains a new feature or new component request labels Dec 12, 2022
@t4keo
Copy link
Author

t4keo commented Dec 12, 2022

#11020

@t4keo
Copy link
Author

t4keo commented Dec 12, 2022

Linked to issues : #12360 and #12361

@t4keo
Copy link
Author

t4keo commented Dec 12, 2022

As a dirty workaround, it’s still possible to do this :

@Component({
  selector: 'app-my-component',
  templateUrl: '<p-password #newPwdInput
                [feedback]="true"
                [toggleMask]="true"
                [(ngModel)]="newPassword"
                id="new-password"></p-password>'
})
export class MyComponent implements AfterViewInit {
  @ViewChild('newPwdInput') newPwdInput: Password;
  newPassword: string;

  constructor() {}

  ngAfterViewInit() {
    this.newPwdInput.input.nativeElement.autocomplete = 'new-password';
  }
}

@oleg-varlamov
Copy link

The same. We also need the ability to pass attributes to input so that the browser reacts correctly. Waiting for decision...

@aplanos
Copy link

aplanos commented Jul 17, 2023

In case anyone has the view hidden, and the password input is lazy loaded, for example when the form is loaded on a hidden sidebar, you can use the same approach than @t4keo, but instead using ngAfterViewInit use:

ngAfterViewChecked() { this.newPassword.input.nativeElement.autocomplete = 'new-password'; }

@mertsincan mertsincan removed Status: Discussion Issue or pull request needs to be discussed by Core Team Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Aug 26, 2023
@mertsincan mertsincan added this to the 16.2.1 milestone Aug 26, 2023
@mertsincan
Copy link
Member

Fixed in #11020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: New Feature Issue contains a new feature or new component request
Projects
None yet
Development

No branches or pull requests

4 participants