-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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(material-experimental/mdc-progress-spinner): fix aria-valuenow #22429
Conversation
setAttribute: (name: string, value: string) => | ||
this._elementRef.nativeElement.setAttribute(name, value), | ||
this._rootElement.setAttribute(name, value), |
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.
Rather than having to introduce another layer in the DOM and move styles around, we could change this method so that it doesn't set the aria-valuenow
. E.g.
setAttribute: (name, value) => {
if (name !== 'aria-valuenow') {
this._elementRef.nativeElement.setAttribute(name, value)
}
}
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.
+1, that would be a better approach here. Separately, though, we should ask mdc why they use 0 to 1 instead of 0 to 100 (as percent).
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.
should we also do the same for mdc progress bar?
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.
If it has the same issue then yes. Both have the same accessibility setup.
8a6d178
to
5c0e11a
Compare
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
setAttribute: (name: string, value: string) => | ||
this._elementRef.nativeElement.setAttribute(name, value), | ||
setAttribute: (name, value) => { | ||
if (name !== 'aria-valuenow') { |
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.
nit: maybe we should have a comment here explaining why we're special-casing it? Also do we have to account for aria-valuemin
and aria-valuemax
?
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.
aria-valuenmin and aria-valuemax are static and set in the host
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. |
Previously the aria-valuenow on mat-progress-spinner was being set through the mdc foundation which deals with values from 0 to 1. This caused the aria-valuenow to be incorrect (eg. 0.6 instead of 60).
Solution: Use
mat-progress-spinner
as a wrapper element instead and have the different circle containers under a separatemdc-circular-progress
div instead of right undermat-progress-spinner
. This way the mdc foundation can interact with the underlyingmdc-circular-progress
div instead of the overallmat-progress-spinner
selector.