diff --git a/src/lib/checkbox/checkbox.spec.ts b/src/lib/checkbox/checkbox.spec.ts index 0b0d4f476dca..855b7f1d1015 100644 --- a/src/lib/checkbox/checkbox.spec.ts +++ b/src/lib/checkbox/checkbox.spec.ts @@ -784,6 +784,14 @@ describe('MatCheckbox', () => { expect(checkbox.tabIndex) .toBe(5, 'Expected tabIndex property to have been set based on the native attribute'); })); + + it('should clear the tabindex attribute from the host element', () => { + fixture = createComponent(CheckboxWithTabindexAttr); + fixture.detectChanges(); + + const checkbox = fixture.debugElement.query(By.directive(MatCheckbox)).nativeElement; + expect(checkbox.getAttribute('tabindex')).toBeFalsy(); + }); }); describe('using ViewChild', () => { diff --git a/src/lib/checkbox/checkbox.ts b/src/lib/checkbox/checkbox.ts index 772ccf3e091a..040e9bd9a93c 100644 --- a/src/lib/checkbox/checkbox.ts +++ b/src/lib/checkbox/checkbox.ts @@ -119,6 +119,7 @@ export const _MatCheckboxMixinBase: host: { 'class': 'mat-checkbox', '[id]': 'id', + '[attr.tabindex]': 'null', '[class.mat-checkbox-indeterminate]': 'indeterminate', '[class.mat-checkbox-checked]': 'checked', '[class.mat-checkbox-disabled]': 'disabled',