Skip to content

Commit d9167dd

Browse files
committed
fix(datepicker): add role to date range input
Adds a `group` role to the date range input since it groups two inputs.
1 parent 298cdc0 commit d9167dd

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/material/datepicker/date-range-input.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ describe('MatDateRangeInput', () => {
8989
expect(fixture.componentInstance.end.nativeElement.getAttribute('type')).toBe('text');
9090
});
9191

92+
it('should set the correct role on the range input', () => {
93+
const fixture = createComponent(StandardRangePicker);
94+
fixture.detectChanges();
95+
const rangeInput = fixture.nativeElement.querySelector('.mat-date-range-input');
96+
expect(rangeInput.getAttribute('role')).toBe('group');
97+
});
98+
9299
it('should mark the entire range input as disabled if both inputs are disabled', () => {
93100
const fixture = createComponent(StandardRangePicker);
94101
fixture.detectChanges();

src/material/datepicker/date-range-input.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ let nextUniqueId = 0;
4747
'class': 'mat-date-range-input',
4848
'[class.mat-date-range-input-hide-placeholders]': '_shouldHidePlaceholders()',
4949
'[attr.id]': 'null',
50+
'role': 'group',
5051
},
5152
changeDetection: ChangeDetectionStrategy.OnPush,
5253
encapsulation: ViewEncapsulation.None,

0 commit comments

Comments
 (0)