From 36667679ab33c510096a5684e5e041a33a6ec364 Mon Sep 17 00:00:00 2001 From: DBowen33 Date: Thu, 15 Aug 2024 00:25:56 +0000 Subject: [PATCH 1/2] fix(material/select): add fix for automcomplete mobile screenr readers added tabindex=-1 to add programmatic focus to mat-options fixes b/272216403 --- src/material/core/option/option.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/material/core/option/option.ts b/src/material/core/option/option.ts index 9c28ddd1cf7c..ff8451040785 100644 --- a/src/material/core/option/option.ts +++ b/src/material/core/option/option.ts @@ -55,6 +55,7 @@ export class MatOptionSelectionChange { exportAs: 'matOption', host: { 'role': 'option', + 'tabindex': '-1', '[class.mdc-list-item--selected]': 'selected', '[class.mat-mdc-option-multiple]': 'multiple', '[class.mat-mdc-option-active]': 'active', From a55dfe734d08385cde5c8dac4a0423428f4316a4 Mon Sep 17 00:00:00 2001 From: DBowen33 Date: Thu, 15 Aug 2024 00:48:09 +0000 Subject: [PATCH 2/2] fix(material/select): fix tests fix tests fixes b/272216403 --- src/material/select/select.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/material/select/select.spec.ts b/src/material/select/select.spec.ts index 14374e689edb..5e13162ada8c 100644 --- a/src/material/select/select.spec.ts +++ b/src/material/select/select.spec.ts @@ -1297,10 +1297,10 @@ describe('MatSelect', () => { .toBe(true); })); - it('should omit the tabindex attribute on each option', fakeAsync(() => { - expect(options[0].hasAttribute('tabindex')).toBeFalse(); - expect(options[1].hasAttribute('tabindex')).toBeFalse(); - expect(options[2].hasAttribute('tabindex')).toBeFalse(); + it('should not omit the tabindex attribute on each option', fakeAsync(() => { + expect(options[0].hasAttribute('tabindex')).toBeTrue(); + expect(options[1].hasAttribute('tabindex')).toBeTrue(); + expect(options[2].hasAttribute('tabindex')).toBeTrue(); })); it('should set aria-disabled for disabled options', fakeAsync(() => {