Skip to content

Calendar accessibility fix#2529

Open
git-nandor wants to merge 1 commit intoINSTUI-4989_DateInput2_days_missing_aria-selectedfrom
calendar_accessibility_fix
Open

Calendar accessibility fix#2529
git-nandor wants to merge 1 commit intoINSTUI-4989_DateInput2_days_missing_aria-selectedfrom
calendar_accessibility_fix

Conversation

@git-nandor
Copy link
Copy Markdown
Contributor

@git-nandor git-nandor commented Apr 27, 2026

INSTUI-5009
INSTUI-5010
INSTUI-5014

Improve date picker calendar accessibility

Changes

  • Add aria-live="polite" aria-atomic="true" to the month/year header in
    Calendar v1 and v2. Previously the container was a <span> wrapping <div>
    children (invalid HTML), causing screen readers to lose track of the live
    region subtree and skip announcements on month navigation. Changed to <div>.

  • Add target month name to navigation button screen reader labels in Calendar
    v1 and v2. Default buttons now announce e.g. "Previous month, November 2023"
    instead of the generic "Previous month".

  • Extend renderPrevMonthButton/renderNextMonthButton prop type from Renderable
    to Renderable<{ targetMonthSrLabel: string }> in Calendar v1 and v2. When
    passed as a function, the render prop receives the pre-formatted target month
    label so consumers can build descriptive accessible names for custom buttons.

  • Update DateInput v2 to use function render props for navigation buttons,
    appending targetMonthSrLabel to the consumer-provided label string so the
    full announcement reads e.g. "Next month, January 2024".

  • Add aria-modal to Dialog when role="dialog" and shouldContainFocus is true,
    scoping the screen reader virtual cursor to the dialog content. Guarded by
    shouldContainFocus so non-modal Dialog usages (Tray without containment,
    DrawerTray during transitions, etc.) are unaffected.

    Test plan

  • Open a DateInput date picker with VoiceOver (macOS) or NVDA (Windows): verify the popover is announced as a dialog with its label (e.g. "Date picker, dialog")

  • The calendar heading displaying the year and month should use an h2

  • The last number in the yearPicker always fully visible

  • With the calendar open, press Tab past the last focusable element and Shift+Tab before the first: verify focus stays inside the picker and does not escape

  • Open a Modal, Tray, and Popover (non–date picker usage): verify aria-modal appears only when shouldContainFocus is true and does not appear on non-modal usages

  • Navigate to the next/previous month using the arrow buttons: verify the screen reader announces the new month and year (e.g. "January 2024") via the aria-live region without requiring the user to move focus

  • Check the previous and next month button accessible names: verify they include the target month (e.g. "Previous month, November 2023" / "Next month, January 2024") and not just the generic label

  • Pass a function to renderPrevMonthButton / renderNextMonthButton on Calendar v2: verify targetMonthSrLabel is received

  <Calendar
  renderPrevMonthButton={({ targetMonthSrLabel }) => (
    <IconButton
      size="small"
      renderIcon={<ChevronLeftInstUIIcon color="baseColor" />}
      screenReaderLabel={`Go to, ${targetMonthSrLabel}`}
    />
  )}
  renderNextMonthButton={({ targetMonthSrLabel }) => (
    <IconButton
      size="small"
      renderIcon={<ChevronRightInstUIIcon color="baseColor" />}
      screenReaderLabel={`Go to, ${targetMonthSrLabel}`}
    />
  )}
  selectedLabel="Selected"
 />

Co-Authored-By: 🤖 Claude

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2529/

Built to branch gh-pages at 2026-04-28 14:32 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@git-nandor git-nandor force-pushed the calendar_accessibility_fix branch 3 times, most recently from f821375 to 545f906 Compare April 27, 2026 18:47
@git-nandor git-nandor marked this pull request as ready for review April 28, 2026 07:10
@git-nandor git-nandor requested review from ToMESSKa and balzss April 28, 2026 07:32
@git-nandor git-nandor self-assigned this Apr 28, 2026
@git-nandor git-nandor force-pushed the calendar_accessibility_fix branch from 545f906 to 8d0db1b Compare April 28, 2026 13:45
Comment on lines 103 to 112
* prop to `small`, `withBorder` and `withBackground` to `false`, and setting
* `renderIcon` to [IconArrowOpenEnd](icons).
*/
renderNextMonthButton?: Renderable
renderNextMonthButton?: Renderable<{ targetMonthSrLabel: string }>
/**
* A button to render in the navigation header. The recommendation is to
* compose it with the [IconButton](Button) component by setting the `size`
* prop to `small`, `withBorder` and `withBackground` to `false`, and setting
* `renderIcon` to [IconArrowOpenStart](icons).
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please update the prop descriptions here too like in v2?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Copy Markdown
Contributor

@ToMESSKa ToMESSKa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice job. See my comment.

…eader, descriptive nav button labels with target month, aria-modal on focused dialogs
@git-nandor git-nandor force-pushed the calendar_accessibility_fix branch from 8d0db1b to 2ac9f89 Compare April 28, 2026 14:27
@git-nandor git-nandor requested a review from ToMESSKa April 28, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants