Skip to content

fix(button-toggle): use native button and aria-pressed for button-toggle #10990

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 20, 2018

Conversation

tinayuangao
Copy link
Contributor

No description provided.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 25, 2018
@tinayuangao tinayuangao added Accessibility This issue is related to accessibility (a11y) pr: needs review labels Apr 25, 2018
(change)="_onInputChange($event)"
(click)="_onInputClick($event)">

<button #button class="mat-button-toggle-button"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs type="button", otherwise it'll submit any parent form elements when it's toggled.

});

it('should have correct aria-pressed attribute', () => {
expect(buttonToggleNativeElement.querySelector('button')!.getAttribute('aria-pressed'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move out the buttonToggleNativeElement.querySelector('button') into a variable since it'll always point to the same element.

@tinayuangao
Copy link
Contributor Author

Comments addressed. Thanks for review!

Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crisbeto crisbeto added pr: lgtm action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release and removed pr: needs review labels Apr 25, 2018
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.

  • The role on the parent element also needs to change. Right now it will use radiogroup for single-selection, which have to contain role="radio". I guess it should just be group all the time now.
  • Is there anything that now communicates that the group supports single or multiple selection?

[id]="buttonId"
[attr.aria-pressed]="checked"
[disabled]="disabled || null"
[attr.name]="name"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to bind name without attr. because it is a DOM property

@jelbourn jelbourn removed pr: lgtm action: merge The PR is ready for merge by the caretaker labels Apr 25, 2018
@tinayuangao
Copy link
Contributor Author

Changed to group role.
Now we don't have a way to communicate whether it supports single or multiple selection.

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

Just tried it out in VoiceOver and it works great.

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Apr 26, 2018
@ngbot
Copy link

ngbot bot commented Apr 26, 2018

I see that you just added the pr: merge ready label, but the following checks are still failing:
    failure missing required label: "release: *"
    failure status "continuous-integration/travis-ci/pr" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

/** Unique ID for the underlying `input` element. */
get inputId(): string { return `${this.id}-input`; }
/** Unique ID for the underlying `button` element. */
get buttonId(): string { return `${this.id}-button`; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a change to the public API and needs to be aliased and marked deprecated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I missed that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Updated and marked deprecated.

@josephperrott josephperrott removed pr: lgtm action: merge The PR is ready for merge by the caretaker labels May 1, 2018
@tinayuangao tinayuangao force-pushed the button-toggle-aria branch from 747bc0f to 92b5e9d Compare May 10, 2018 02:19
@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels May 10, 2018
@ngbot
Copy link

ngbot bot commented May 10, 2018

I see that you just added the pr: merge ready label, but the following checks are still failing:
    failure status "continuous-integration/travis-ci/pr" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@jelbourn
Copy link
Member

@tinayuangao looks like a small lint error (missing semi-colon)

@jelbourn jelbourn removed the action: merge The PR is ready for merge by the caretaker label May 10, 2018
@tinayuangao tinayuangao force-pushed the button-toggle-aria branch from 92b5e9d to 2d3ea59 Compare May 10, 2018 05:15
@jelbourn
Copy link
Member

@tinayuangao can you look at the failures on this PR?

@tinayuangao tinayuangao force-pushed the button-toggle-aria branch from 2d3ea59 to 18bbb93 Compare June 4, 2018 18:40
@tinayuangao tinayuangao force-pushed the button-toggle-aria branch from 18bbb93 to 8ffb4ef Compare June 4, 2018 20:59
@jelbourn jelbourn added the action: merge The PR is ready for merge by the caretaker label Jun 19, 2018
@tinayuangao tinayuangao merged commit 1ff9cf0 into angular:master Jun 20, 2018
@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 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Accessibility This issue is related to accessibility (a11y) action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants