Skip to content

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

Merged
merged 1 commit into from
Jun 22, 2017

Conversation

devversion
Copy link
Member

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.

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.
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 21, 2017
@@ -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()',
Copy link
Member

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 + ''

Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member Author

@devversion devversion Jun 21, 2017

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.

Copy link
Member

@jelbourn jelbourn left a 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

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Jun 21, 2017
@jelbourn jelbourn merged commit 5a38a9f into angular:master Jun 22, 2017
@devversion devversion deleted the refactor/chips-button-to-string branch November 11, 2017 10:23
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants