Skip to content

Commit 87b7270

Browse files
wolandeczernonia
andauthored
fix(RangeCalendar): a11y aria attribute in CellTrigger (#2265)
* fix: a11y aria attribute in RangeCalendarCellTrigger.vue * chore: add a11y tests --------- Co-authored-by: zernonia <[email protected]>
1 parent f69fe29 commit 87b7270

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

packages/core/src/RangeCalendar/RangeCalendar.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,4 +838,27 @@ describe('handles maximumDays', () => {
838838
expect(maximumDay).toHaveAttribute('data-highlighted')
839839
expect(beyondMaximumDay).not.toHaveAttribute('data-highlighted')
840840
})
841+
842+
describe('a11y', async () => {
843+
it('should pass axe accessibility tests when closed', async () => {
844+
const { calendar } = setup({
845+
calendarProps: {
846+
modelValue: calendarDateRange,
847+
},
848+
})
849+
850+
expect(await axe(calendar)).toHaveNoViolations()
851+
})
852+
853+
it('should pass axe accessibility tests when open', async () => {
854+
const { calendar } = setup({
855+
calendarProps: {
856+
},
857+
})
858+
859+
calendar.click()
860+
861+
expect(await axe(calendar)).toHaveNoViolations()
862+
})
863+
})
841864
})

packages/core/src/RangeCalendar/RangeCalendarCellTrigger.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ function handleArrowKey(e: KeyboardEvent) {
242242
role="button"
243243
:aria-label="labelText"
244244
data-reka-calendar-cell-trigger
245-
:aria-selected="isSelectedDate && (allowNonContiguousRanges || !isUnavailable) ? true : undefined"
245+
:aria-pressed="isSelectedDate && (allowNonContiguousRanges || !isUnavailable) ? true : undefined"
246246
:aria-disabled="isDisabled || isUnavailable ? true : undefined"
247247
:data-highlighted="isHighlighted && (allowNonContiguousRanges || !isUnavailable) ? '' : undefined"
248248
:data-selection-start="isSelectionStart ? true : undefined"

0 commit comments

Comments
 (0)