-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(docs): password visibility toggle example in form field component… #15129
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
fix(docs): password visibility toggle example in form field component… #15129
Conversation
@@ -1,7 +1,9 @@ | |||
<div class="example-container"> | |||
<mat-form-field> | |||
<input matInput placeholder="Enter your password" [type]="hide ? 'password' : 'text'"> | |||
<mat-icon matSuffix (click)="hide = !hide">{{hide ? 'visibility_off' : 'visibility'}}</mat-icon> | |||
<button mat-icon-button matSuffix (click)="hide = !hide" aria-label="Show or hide password icon"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The aria-label
show be different based on whether the button is going to show or hide the value:
[attr.aria-label]="hide ? 'Hide password' : 'Show password'"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed as per your suggestion. Can you please check now
Looking at this made me realize that this should actually use a |
Yes sure. Will do that jelbourn |
@jelbourn If we use toggle button the appearance is as shown in the image. Normal button is looking good inside the input as compared to toggle button. |
Yeah, that does look weird. I think the right thing to do here is to use a regular button with |
@jelbourn updated with aria-pressed attribute |
@@ -1,7 +1,9 @@ | |||
<div class="example-container"> | |||
<mat-form-field> | |||
<input matInput placeholder="Enter your password" [type]="hide ? 'password' : 'text'"> | |||
<mat-icon matSuffix (click)="hide = !hide">{{hide ? 'visibility_off' : 'visibility'}}</mat-icon> | |||
<button mat-icon-button matSuffix (click)="hide = !hide" [attr.aria-label]="'Hide password'" [attr.aria-pressed] = hide> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit: omit spaces and add double-quotes:
[attr.aria-pressed]="hide"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes #15023