Skip to content

Revert "fix(radio): host element unable to receive focus events" #14468

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 7 commits into from
Dec 11, 2018
3 changes: 1 addition & 2 deletions src/lib/radio/radio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ $mat-radio-ripple-radius: 20px;
.mat-radio-button {
display: inline-block;
-webkit-tap-highlight-color: transparent;
outline: 0;
}

// Inner label container, wrapping entire element.
Expand Down Expand Up @@ -142,7 +141,7 @@ $mat-radio-ripple-radius: 20px;
opacity: 0.04;
}

.mat-radio-button:not(.mat-radio-disabled).cdk-focused & {
.mat-radio-button.cdk-focused & {
opacity: 0.12;
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/radio/radio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ describe('MatRadio', () => {
const radioButtonEl =
predefinedFixture.debugElement.query(By.css('.mat-radio-button')).nativeElement;

expect(radioButtonEl.getAttribute('tabindex')).toBe('-1');
expect(radioButtonEl.getAttribute('tabindex')).toBeFalsy();
});

});
Expand Down
3 changes: 1 addition & 2 deletions src/lib/radio/radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,7 @@ export const _MatRadioButtonMixinBase:
'[class.mat-radio-checked]': 'checked',
'[class.mat-radio-disabled]': 'disabled',
'[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
// Needs to be -1 so the `focus` event still fires.
'[attr.tabindex]': '-1',
'[attr.tabindex]': 'null',
'[attr.id]': 'id',
// Note: under normal conditions focus shouldn't land on this element, however it may be
// programmatically set, for example inside of a focus trap, in this case we want to forward
Expand Down