Skip to content

Commit

Permalink
fix(accessibility): remove aria-controls
Browse files Browse the repository at this point in the history
  • Loading branch information
gpbl committed Jul 14, 2024
1 parent 3106ed5 commit 13c56ab
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 17 deletions.
6 changes: 0 additions & 6 deletions examples/__snapshots__/Range.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ exports[`should match the snapshot 1`] = `
role="navigation"
>
<button
aria-controls="test"
aria-label="Go to the Previous Month"
class="rdp-button_previous"
type="button"
Expand All @@ -34,7 +33,6 @@ exports[`should match the snapshot 1`] = `
</svg>
</button>
<button
aria-controls="test"
aria-label="Go to the Next Month"
class="rdp-button_next"
type="button"
Expand All @@ -56,7 +54,6 @@ exports[`should match the snapshot 1`] = `
>
<div
class="rdp-month_caption"
id="test-caption-0"
>
<span
aria-live="polite"
Expand Down Expand Up @@ -659,7 +656,6 @@ exports[`when a day in the range is clicked when the day is clicked again when a
role="navigation"
>
<button
aria-controls="test"
aria-label="Go to the Previous Month"
class="rdp-button_previous"
type="button"
Expand All @@ -676,7 +672,6 @@ exports[`when a day in the range is clicked when the day is clicked again when a
</svg>
</button>
<button
aria-controls="test"
aria-label="Go to the Next Month"
class="rdp-button_next"
type="button"
Expand All @@ -698,7 +693,6 @@ exports[`when a day in the range is clicked when the day is clicked again when a
>
<div
class="rdp-month_caption"
id="test-caption-0"
>
<span
aria-live="polite"
Expand Down
3 changes: 0 additions & 3 deletions examples/__snapshots__/StylingCssModules.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ exports[`should match the snapshot 1`] = `
role="navigation"
>
<button
aria-controls=":r0:"
aria-label="Go to the Previous Month"
class="rdp-button_previous"
type="button"
Expand All @@ -35,7 +34,6 @@ exports[`should match the snapshot 1`] = `
</svg>
</button>
<button
aria-controls=":r0:"
aria-label="Go to the Next Month"
class="rdp-button_next"
type="button"
Expand All @@ -57,7 +55,6 @@ exports[`should match the snapshot 1`] = `
>
<div
class="rdp-month_caption"
id=":r0:-caption-0"
>
<span
aria-live="polite"
Expand Down
8 changes: 0 additions & 8 deletions src/DayPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ import { useSelection } from "./useSelection.js";
* @see http://daypicker.dev
*/
export function DayPicker(props: DayPickerProps) {
const reactId = React.useId();
const id = props.id ?? reactId;

const {
captionLayout,
dir,
Expand Down Expand Up @@ -319,7 +316,6 @@ export function DayPicker(props: DayPickerProps) {
tabIndex={calendar.previousMonth ? undefined : -1}
disabled={calendar.previousMonth ? undefined : true}
aria-label={labelPrevious(previousMonth, labelOptions)}
aria-controls={id}
onClick={handlePreviousClick}
>
<components.Chevron
Expand All @@ -334,7 +330,6 @@ export function DayPicker(props: DayPickerProps) {
tabIndex={nextMonth ? undefined : -1}
disabled={nextMonth ? undefined : true}
aria-label={labelNext(nextMonth, labelOptions)}
aria-controls={id}
onClick={handleNextClick}
>
<components.Chevron
Expand All @@ -346,8 +341,6 @@ export function DayPicker(props: DayPickerProps) {
</components.Nav>
)}
{months.map((calendarMonth, displayIndex) => {
const captionId = `${id}-caption-${displayIndex}`;

const handleMonthChange: ChangeEventHandler<HTMLSelectElement> = (
e
) => {
Expand Down Expand Up @@ -398,7 +391,6 @@ export function DayPicker(props: DayPickerProps) {
<components.MonthCaption
className={classNames[UI.MonthCaption]}
style={styles?.[UI.MonthCaption]}
id={captionId}
calendarMonth={calendarMonth}
displayIndex={displayIndex}
>
Expand Down

0 comments on commit 13c56ab

Please sign in to comment.