Skip to content

Commit ac97157

Browse files
authored
Revert "fix(checkbox): redirect focus to underlying input element" (#14469)
* Revert "Revert "fix(radio): host element unable to receive focus events" (#14468)" This reverts commit 4aa47c7. * Revert "Revert "fix(a11y): activeItem out of date if active index is removed from ListKeyManager" (#14467)" This reverts commit 8f790f5. * Revert "build: update sauce connect (#14422)" This reverts commit bc563b7. * Revert "build: changelog script not filtering duplicate entries (#14421)" This reverts commit fe46290. * Revert "build: update to angular 7.1.2 (#14418)" This reverts commit e1487df. * Revert "refactor(drag-drop): move logic out of directives (#14350)" This reverts commit 19f9bca. * Revert "fix(checkbox): redirect focus to underlying input element (#13959)" This reverts commit e0eb3df.
1 parent 4aa47c7 commit ac97157

File tree

3 files changed

+2
-13
lines changed

3 files changed

+2
-13
lines changed

src/lib/checkbox/checkbox.scss

-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * $mat-checkbox-size !default;
182182

183183
cursor: pointer;
184184
-webkit-tap-highlight-color: transparent;
185-
outline: 0;
186185

187186
.mat-ripple-element:not(.mat-checkbox-persistent-ripple) {
188187
opacity: 0.16;

src/lib/checkbox/checkbox.spec.ts

+1-10
Original file line numberDiff line numberDiff line change
@@ -370,15 +370,6 @@ describe('MatCheckbox', () => {
370370
expect(document.activeElement).toBe(inputElement);
371371
});
372372

373-
it('should focus on underlying input element when the host is focused', () => {
374-
expect(document.activeElement).not.toBe(inputElement);
375-
376-
checkboxNativeElement.focus();
377-
fixture.detectChanges();
378-
379-
expect(document.activeElement).toBe(inputElement);
380-
});
381-
382373
it('should forward the value to input element', () => {
383374
testComponent.checkboxValue = 'basic_checkbox';
384375
fixture.detectChanges();
@@ -799,7 +790,7 @@ describe('MatCheckbox', () => {
799790
fixture.detectChanges();
800791

801792
const checkbox = fixture.debugElement.query(By.directive(MatCheckbox)).nativeElement;
802-
expect(checkbox.getAttribute('tabindex')).toBe('-1');
793+
expect(checkbox.getAttribute('tabindex')).toBeFalsy();
803794
});
804795
});
805796

src/lib/checkbox/checkbox.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,12 @@ export const _MatCheckboxMixinBase:
119119
host: {
120120
'class': 'mat-checkbox',
121121
'[id]': 'id',
122-
'[attr.tabindex]': '-1', // Reset back to -1 so that the `focus` event still works.
122+
'[attr.tabindex]': 'null',
123123
'[class.mat-checkbox-indeterminate]': 'indeterminate',
124124
'[class.mat-checkbox-checked]': 'checked',
125125
'[class.mat-checkbox-disabled]': 'disabled',
126126
'[class.mat-checkbox-label-before]': 'labelPosition == "before"',
127127
'[class._mat-animation-noopable]': `_animationMode === 'NoopAnimations'`,
128-
'(focus)': '_inputElement.nativeElement.focus()',
129128
},
130129
providers: [MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR],
131130
inputs: ['disableRipple', 'color', 'tabIndex'],

0 commit comments

Comments
 (0)