Skip to content

fix(material/radio): remove tabindex from host node #21280

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
Jan 19, 2021

Conversation

crisbeto
Copy link
Member

Removes the tabindex from the host node, because it causes some a11y issues. We had it there before so that things like cdkFocusInitial would work, but after #21046 it isn't necessary anymore.

Fixes #21266.

Removes the `tabindex` from the host node, because it causes some a11y issues.
We had it there before so that things like `cdkFocusInitial` would work, but
after angular#21046 it isn't necessary anymore.

Fixes angular#21266.
@crisbeto crisbeto added P2 The issue is important to a large percentage of users, with a workaround Accessibility This issue is related to accessibility (a11y) G This is is related to a Google internal issue target: patch This PR is targeted for the next patch release labels Dec 11, 2020
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 11, 2020
expect(radioButtonEl.getAttribute('tabindex')).toBe('-1');
});

it('should set the tabindex to -1 on the host element', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

This test was exactly the same as the one above so I removed it.

@@ -97,7 +97,8 @@ export class MatRadioGroup extends _MatRadioGroupBase<MatRadioButton> {
'[class.mat-primary]': 'color === "primary"',
'[class.mat-accent]': 'color === "accent"',
'[class.mat-warn]': 'color === "warn"',
'[attr.tabindex]': 'disabled ? null : -1',
// Needs to be removed since it causes some a11y issues (see #21266).
'[attr.tabindex]': 'null',
Copy link
Contributor

Choose a reason for hiding this comment

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

does it specifically have to be null or can it just be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

It has to be null, because the tabindex can be set as <mat-radio tabindex="2"> which will set the input, but also keep the native attribute.

@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Dec 11, 2020
@mmalerba mmalerba merged commit cdfc46b into angular:master Jan 19, 2021
mmalerba pushed a commit that referenced this pull request Jan 19, 2021
Removes the `tabindex` from the host node, because it causes some a11y issues.
We had it there before so that things like `cdkFocusInitial` would work, but
after #21046 it isn't necessary anymore.

Fixes #21266.

(cherry picked from commit cdfc46b)
mmalerba pushed a commit that referenced this pull request Jan 19, 2021
Removes the `tabindex` from the host node, because it causes some a11y issues.
We had it there before so that things like `cdkFocusInitial` would work, but
after #21046 it isn't necessary anymore.

Fixes #21266.

(cherry picked from commit cdfc46b)
crisbeto added a commit to crisbeto/material2 that referenced this pull request Jan 19, 2021
Similar to angular#21280. Removes the `tabindex` from the `mat-datepicker-toggle` host since it
can caused accessibility issues. It was only there as a workaround which isn't required
after angular#21046.
wagnermaciel pushed a commit to wagnermaciel/components that referenced this pull request Jan 20, 2021
Removes the `tabindex` from the host node, because it causes some a11y issues.
We had it there before so that things like `cdkFocusInitial` would work, but
after angular#21046 it isn't necessary anymore.

Fixes angular#21266.
andrewseguin pushed a commit that referenced this pull request Jan 25, 2021
Similar to #21280. Removes the `tabindex` from the `mat-datepicker-toggle` host since it
can caused accessibility issues. It was only there as a workaround which isn't required
after #21046.
andrewseguin pushed a commit that referenced this pull request Jan 25, 2021
Similar to #21280. Removes the `tabindex` from the `mat-datepicker-toggle` host since it
can caused accessibility issues. It was only there as a workaround which isn't required
after #21046.

(cherry picked from commit 2e783b4)
wagnermaciel pushed a commit to wagnermaciel/components that referenced this pull request Jan 26, 2021
Similar to angular#21280. Removes the `tabindex` from the `mat-datepicker-toggle` host since it
can caused accessibility issues. It was only there as a workaround which isn't required
after angular#21046.
mmalerba pushed a commit to mmalerba/components that referenced this pull request Jan 29, 2021
Similar to angular#21280. Removes the `tabindex` from the `mat-datepicker-toggle` host since it
can caused accessibility issues. It was only there as a workaround which isn't required
after angular#21046.
wagnermaciel pushed a commit to wagnermaciel/components that referenced this pull request Feb 8, 2021
Similar to angular#21280. Removes the `tabindex` from the `mat-datepicker-toggle` host since it
can caused accessibility issues. It was only there as a workaround which isn't required
after angular#21046.
wagnermaciel pushed a commit to wagnermaciel/components that referenced this pull request Feb 8, 2021
Similar to angular#21280. Removes the `tabindex` from the `mat-datepicker-toggle` host since it
can caused accessibility issues. It was only there as a workaround which isn't required
after angular#21046.
@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 Feb 19, 2021
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 G This is is related to a Google internal issue P2 The issue is important to a large percentage of users, with a workaround target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(mat-radio-button): mat-radio-button node wrongly reports as a semantic node resulting in bad SR announcement
3 participants