Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamline the touch screen reader experience for Calendar #3032

Merged
merged 5 commits into from
Apr 21, 2022

Conversation

devongovett
Copy link
Member

@devongovett devongovett commented Apr 13, 2022

Depends on #3005.

This attempts to improve the experience of using a Calendar with a touch screen reader.

  • Changes the DOM order of some elements to make things more clear. The month heading is now first rather than the previous button. Since at least VO on iOS does not announce the group wrapper, it only announced "Previous" before which was a confusing thing to encounter first. Now you get to the heading first, and then the previous button. Desktop-based screen readers are better about announcing the group label, so it's fine that previous is still first in the tab order I think.
  • The next button is moved after the calendar grid, so that after navigating through all the dates in the month, it's easy to navigate to the next month rather than needing to go all the way back to the start to get to it.
  • An extra visually hidden next button is added just after the previous button, before the calendar grid, however, because you may hear the month heading and already know you need to navigate to the previous/next month without having to go through all the days. So there are two next buttons for screen reader users now.
  • The above means the tab order is now previous button, calendar grid, next button, rather than previous button, next button, calendar grid.
  • When more than one month is displayed, the headings before each month are aria-hidden, and instead, the entire visible range is described in a visually hidden heading before the calendar grids (i.e. "March to May 2022"). This avoids extra swipes to get to the next day when navigating with a touch screen reader, and better conveys that there are multiple months visible before you navigate through them.
  • The day name column headers are aria-hidden in the Calendar grid. This avoids touch screen reader users needing to swipe through all day names before getting to the actual days they can select. It also avoids day names being announced twice when focusing a date, because first the column header is announced and then the cell label which also includes the day name. This is potentially a little non-kosher, but I think it makes things easier to use and the column headers are kinda unnecessary for screen reader users.
  • Changed the labeling structure so the visible range is in the aria-label of the role="group" element rather than aria-describedby because VoiceOver on desktop does not announce the aria-describedby when tabbing into it.

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

Copy link
Collaborator

@majornista majornista left a comment

Choose a reason for hiding this comment

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

In my opinion, PageUp and PageDown should always increment or decrement by month regardless of the visible range, this way a screen reader user can quickly navigate to the previous or next month using the same command. advancing by two or three months is really confusing when using a screen reader.

disabled={nextButtonProps.isDisabled}
onClick={() => state.focusNextPage()}
tabIndex={-1} />
</VisuallyHidden>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if it might make more sense if the VisuallyHidden Next button were after the Calendar grid and the visible next button were to remain before the grid.

Copy link
Member Author

Choose a reason for hiding this comment

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

Personally I found it to make sense that if you're on the date grid, you can shift tab to get to the previous button and tab to get to the next button. If we put them both before, then you have to tab through both to get to the dates, and shift tab to get to both buttons from the dates. What made you think putting the next button first would make more sense?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The previous and next month buttons in native input[type=date] control are both before the table. Same is true for https://www.w3.org/TR/wai-aria-practices/examples/dialog-modal/datepicker-dialog.html. Feels more intuitive tabbing left to right, top to bottom.

@devongovett
Copy link
Member Author

In my opinion, PageUp and PageDown should always increment or decrement by month regardless of the visible range, this way a screen reader user can quickly navigate to the previous or next month using the same command. advancing by two or three months is really confusing when using a screen reader.

I guess I did it so that page up/page down matched what the next/previous buttons do, but I suppose we could make them different. Is that what you were thinking?

@majornista
Copy link
Collaborator

In my opinion, PageUp and PageDown should always increment or decrement by month regardless of the visible range, this way a screen reader user can quickly navigate to the previous or next month using the same command. advancing by two or three months is really confusing when using a screen reader.

I guess I did it so that page up/page down matched what the next/previous buttons do, but I suppose we could make them different. Is that what you were thinking?

Yes. I'm fine with the next and previous buttons navigating by two or three months at a time, because the user is not immediately interacting with the grid, but for a keyboard or screen reader user interacting on a date within the table the behavior should remain consistent; PageUp or PageDown should navigate by month and Shift+PageUp or Shift+PageDown by year. Particularly with the date range picker, if I start selecting with focus within the first of three calendars in the visible range, and want to select a month, it would be really odd for three months to become selected, and to no longer be able to see the start of the selection or the two other months that were selected.

Base automatically changed from calendar-fixes2 to main April 14, 2022 15:43
@devongovett devongovett force-pushed the calendar-touch-screenreader branch from 3318a79 to 86c4609 Compare April 14, 2022 16:03
@adobe-bot
Copy link

Build successful! 🎉

@devongovett
Copy link
Member Author

I'll do the keyboard navigation change in a separate PR since it's not really related to the changes here.

Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

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

Tested on my Android via Talkback and on a iPad with VoiceOver, definitely feels a lot more streamlined.

packages/@react-aria/calendar/src/useCalendarBase.ts Outdated Show resolved Hide resolved
packages/@react-spectrum/calendar/src/CalendarBase.tsx Outdated Show resolved Hide resolved
@devongovett devongovett marked this pull request as ready for review April 20, 2022 19:24
@adobe-bot
Copy link

Build successful! 🎉

LFDanLu
LFDanLu previously approved these changes Apr 20, 2022
Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

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

LGTM, tested on Android Talkback and iOS Voiceover, confirmed the reverted tab order of the next/prev button + the announcement of the visually hidden header that is always present.

@devongovett devongovett force-pushed the calendar-touch-screenreader branch from 9133249 to 8a9a88f Compare April 20, 2022 21:22
@devongovett devongovett changed the title Experiment with streamlining the touch screen reader experience for Calendar Streamline the touch screen reader experience for Calendar Apr 20, 2022
@adobe-bot
Copy link

Build successful! 🎉

@devongovett devongovett force-pushed the calendar-touch-screenreader branch from 5858248 to 8a9a88f Compare April 20, 2022 22:34
@adobe-bot
Copy link

Build successful! 🎉

Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

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

Verified that the dates in the range selection don't fade in/out when switching months on mobile anymore

@devongovett devongovett merged commit 86ac34a into main Apr 21, 2022
@devongovett devongovett deleted the calendar-touch-screenreader branch April 21, 2022 16:15
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.

5 participants