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

fix(DatePickerInput): announce keyboard guide #5375

Conversation

asudoh
Copy link
Contributor

@asudoh asudoh commented Feb 18, 2020

This change adds a content that is referred from aria-describedby in date picker's <input> (for single/range mode). The content announces how to navigate to, and how to navigate within calendar dropdown by keyboard.

There were a few options in order to announce how to navigate to date picker; Two of them are from W3C WAI-ARIA Authoring Practices 1.1, a) Date Picker Dialog Example, b) Combobox with Grid Popup Example.

a) has very different user interaction model from ours, because we want date picker to be open when the <input> gets focus but a) opens date picker only when the calendar icon is clicked.

b) lets us announce the existence of dropdown, etc. in a similar manner as our other dropdown components do, but role="combobox" does not sound adequate for a date picker.

Therefore, this change uses a custom content to announce how to navigate to calendar dropdown, rather than the content screen reader automatically creates/announces.

Refs #5310.

Changelog

New

  • calendarDropdownAssistiveText prop, that is used by screen reader so we can guide user how to open and navigate within calendar dropdown by keyboard.

Testing / Reviewing

Testing should make sure our date picker is not broken.

This change adds a content that is referred from `aria-describedby` in
date picker's `<input>` (for single/range mode). The content announces
how to navigate to, and how to navigate within calendar dropdown by
keyboard.

There were a few options in order to announce how to navigate to date
picker; Two of them are from W3C WAI-ARIA Authoring Practices 1.1, a)
Date Picker Dialog Example, b) Combobox with Grid Popup Example.

a) has very different user interaction model from ours, because we want
date picker to be open when the `<input>` gets focus but a) opens date
picker only when the calendar icon is clicked.

b) lets us announce the existence of dropdown, etc. in a similar manner
as our other dropdown components do, but `role="combobox"` does not
sound adequate for a date picker.

Therefore, this change uses a custom content to announce how to
navigate to calendar dropdown, rather than the content screen reader
automatically creates/announces.

Refs carbon-design-system#5310.
@netlify
Copy link

netlify bot commented Feb 18, 2020

Deploy preview for carbon-elements ready!

Built with commit 8f843a8

https://deploy-preview-5375--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Feb 18, 2020

Deploy preview for carbon-components-react ready!

Built with commit 8f843a8

https://deploy-preview-5375--carbon-components-react.netlify.com

@abbeyhrt abbeyhrt requested a review from dakahn February 18, 2020 16:19
Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

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

looks good to me, just want to confirm this pattern for assistive text in the date picker

image

};

static defaultProps = {
pattern: '\\d{1,2}\\/\\d{1,2}\\/\\d{4}',
type: 'text',
disabled: false,
invalid: false,
calendarDropdownAssistiveText: [
'Use down arrow key to navigate to calendar dropdown.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense for us to specify arrow keys as the interaction mechanism when someone may be using VO on iOS?

@abbeyhrt
Copy link
Contributor

@asudoh I'm hesitant to be this specific with the directions on how to use the DatePicker with a screenreader, partially because of the differences between platforms and screenreaders but mainly because it makes us really beholden to this working exactly as stated. For example, it announces "Use down arrow key to navigate to dropdown calendar" but that doesn't work in VO when moving from that div. The intent to help is really good here but if the instructions don't work, it ends up being more confusing

@asudoh
Copy link
Contributor Author

asudoh commented Feb 19, 2020

@abbeyhrt Thank you for your thoughts!

For example, it announces "Use down arrow key to navigate to dropdown calendar" but that doesn't work in VO when moving from that div.

Could you please elaborate? I'm not sure what <div> you are referring to especially because the announcement happens when user focusing on an <input> instead of a <div>. Or did you actually mean the <input>...?

@abbeyhrt
Copy link
Contributor

Yeah for sure! This might be something with my VO settings but for me, it announces when I'm VO-focused on this:

            <div
              id={`${id}__assistive-text`}
              className={`${prefix}--assistive-text`}>
              {calendarDropdownAssistiveText}
            </div>

Screen Shot 2020-02-20 at 11 54 38 AM

The focus is still on the input but the VO focus (the little black square in the picture) is on that div and so using down arrow from there doesn't navigate the screenreader to the calendar.

@asudoh
Copy link
Contributor Author

asudoh commented Feb 21, 2020

Thank you for clarifying @abbeyhrt! Will see if there is a better announcement along with a better interaction model.

@dakahn dakahn removed their request for review March 5, 2020 23:21
@joshblack joshblack mentioned this pull request Mar 20, 2020
82 tasks
@joshblack
Copy link
Contributor

Hey there! Going through the PR backlog today and am clearing out PRs that have been up for a while 👀

@joshblack joshblack closed this Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants