Skip to content

Commit 4e845e7

Browse files
authored
fix: apply aria-details on the calendar (#8042)
* fix: pass aria-details to the calendar props * add: aria prop test for calendar
1 parent 7e8b1f9 commit 4e845e7

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

packages/@react-aria/calendar/src/useCalendarBase.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export function useCalendarBase(props: CalendarPropsBase & DOMProps & AriaLabeli
9393
return {
9494
calendarProps: mergeProps(domProps, labelProps, {
9595
role: 'application',
96+
'aria-details': props['aria-details'] || undefined,
9697
'aria-describedby': props['aria-describedby'] || undefined
9798
}),
9899
nextButtonProps: {

packages/react-aria-components/test/Calendar.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,21 @@ describe('Calendar', () => {
8383
}
8484
});
8585

86+
it('should support aria props on the Calendar', () => {
87+
let {getByRole} = renderCalendar({
88+
'aria-label': 'label',
89+
'aria-labelledby': 'labelledby',
90+
'aria-describedby': 'describedby',
91+
'aria-details': 'details'
92+
});
93+
94+
let group = getByRole('application');
95+
expect(group).toHaveAttribute('aria-label', expect.stringContaining('label'));
96+
expect(group).toHaveAttribute('aria-labelledby', expect.stringContaining('labelledby'));
97+
expect(group).toHaveAttribute('aria-describedby', 'describedby');
98+
expect(group).toHaveAttribute('aria-details', 'details');
99+
});
100+
86101
it('should support custom CalendarGridHeader', () => {
87102
let {getByRole} = render(
88103
<Calendar aria-label="Appointment date">

0 commit comments

Comments
 (0)