From 484d7ccf7809e15e8f542e50d402cb2bf704cacb Mon Sep 17 00:00:00 2001 From: visuallization Date: Mon, 2 Jun 2025 14:05:45 +0200 Subject: [PATCH 1/2] feat(a11y): added role prop --- packages/react-calendar/src/Calendar.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/react-calendar/src/Calendar.tsx b/packages/react-calendar/src/Calendar.tsx index a9aa6745..8b28b168 100644 --- a/packages/react-calendar/src/Calendar.tsx +++ b/packages/react-calendar/src/Calendar.tsx @@ -328,6 +328,13 @@ export type CalendarProps = { * @example 'range' */ returnValue?: 'start' | 'end' | 'range'; + /** + * The WAI-ARIA role of the calendar. + * + * @default 'dialog' + * @example 'dialog' + */ + role?: React.AriaRole; /** * Whether the user shall select two dates forming a range instead of just one. **Note**: This feature will make react-calendar return array with two dates regardless of returnValue setting. * @@ -643,6 +650,7 @@ const Calendar: React.ForwardRefExoticComponent {renderNavigation()}
Date: Mon, 2 Jun 2025 14:17:26 +0200 Subject: [PATCH 2/2] feat(a11y): added aria label for cotainer --- packages/react-calendar/src/Calendar.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/react-calendar/src/Calendar.tsx b/packages/react-calendar/src/Calendar.tsx index 8b28b168..be53bcd5 100644 --- a/packages/react-calendar/src/Calendar.tsx +++ b/packages/react-calendar/src/Calendar.tsx @@ -63,6 +63,12 @@ export type CalendarProps = { * @example true */ allowPartialRange?: boolean; + /** + * `aria-label` attribute of the calendar container. + * + * @example 'Calendar' + */ + ariaLabel?: string; /** * Type of calendar that should be used. Can be `'gregory`, `'hebrew'`, `'islamic'`, `'iso8601'`. Setting to `"gregory"` or `"hebrew"` will change the first day of the week to Sunday. Setting to `"islamic"` will change the first day of the week to Saturday. Setting to `"islamic"` or `"hebrew"` will make weekends appear on Friday to Saturday. * @@ -609,6 +615,7 @@ const Calendar: React.ForwardRefExoticComponent {renderNavigation()}