3

i have a password field created using angular material. and there is a password visibility toggle button there. if it were a simple button i could have set tabindex="-1", but tabindex doesn't work on "mat-pass-toggle-visibility"

                  <mat-form-field appearance="fill" style="width: 100%;" class="input-custo-design">
                    <mat-label>Password</mat-label>
                    <mat-pass-toggle-visibility #toggle matSuffix></mat-pass-toggle-visibility>

                    <input matInput [type]="toggle.type" placeholder="Password" formControlName="pass" #passwordWithValidation />
                    <mat-error *ngIf="signupController.pass.errors?.required">Password is required
                    </mat-error>
                   
                  </mat-form-field>

enter image description here

i got a github link mat-password, where this issue is there, but currently is there somehow i can do a workaround??

in chrome dev-tools i can see "mat-pass-toggle-visibility" does in the end create a button only. so can we set any directive or such thing.

2 Answers 2

3

for my use case i got another way around: using the normal button class

<mat-form-field appearance="fill" style="width: 100%;" class="input-custo-design">
  <mat-label>Password</mat-label>
  <input matInput [type]="hideSignUp ? 'password' : 'text'" placeholder="Password" formControlName="pass" #passwordWithValidation />
                    
  <button
   type="button"
   mat-icon-button
   matSuffix
   (click)="hideSignUp = !hideSignUp"
   [attr.aria-label]="'Hide password'"
   [attr.aria-pressed]="hide"
   tabindex="-1"
 >
 <mat-icon>{{
   hideSignUp ? "visibility_off" : "visibility"
 }}</mat-icon>
 </button>
 <mat-error *ngIf="signupController.pass.errors?.required">Password is required</mat-error>
</mat-form-field>
Sign up to request clarification or add additional context in comments.

Comments

0

The ability to specify tabindex was added with this pull request.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.