-
Notifications
You must be signed in to change notification settings - Fork 6.8k
refactor(button, chips): use toString method for aria-disabled #5278
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
refactor(button, chips): use toString method for aria-disabled #5278
Conversation
For buttons and chips the value of the aria-disabled host binding is resolved from a extra method on the class instance. As already done in other components, the button and chips should just use `boolean.toString()` which is less payload and also makes the code more readable.
@@ -193,7 +193,7 @@ export class MdButton extends _MdButtonMixinBase implements OnDestroy, CanDisabl | |||
a[mat-button], a[mat-raised-button], a[mat-icon-button], a[mat-fab], a[mat-mini-fab]`, | |||
host: { | |||
'[attr.disabled]': 'disabled || null', | |||
'[attr.aria-disabled]': '_isAriaDisabled', | |||
'[attr.aria-disabled]': 'disabled.toString()', |
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 we're going shorter, could also do disabled + ''
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.
Hmm not sure about that. toString()
explains what it does and is also pretty short.
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.
+ ''
is pretty idiomatic javascript imo
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.
Yeah totally. I think it just depends, it's kinda weird doing this in a host binding while we would need to escape the quote (or use the double quote)
I personally prefer toString()
as it's describing what it does and is also consistent with all other aria-disabled
host bindings.
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
I don't care that much one way or the other
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. |
For buttons and chips the value of the aria-disabled host binding is resolved from an extra method on the class instance.
As already done in other components, the button and chips should just use
boolean.toString()
which is less payload and also makes the code more readable.