Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@CTGM-Bixal
Copy link
Contributor

@CTGM-Bixal CTGM-Bixal commented Aug 7, 2024

Summary

Updated toggleCalendar function to account for aria-disabled attribute + readonly. The new code added prevents users from selecting a date while allowing the button to remain discoverable, which is required for accessibility. It also adds the readonly which effectively replicates disabled behaviors without the accessibility concerns.

Breaking change

This is not a breaking change.

Related issue

Closes #5982

Related PR

Changelog PR

Preview link

Preview link:
Date Picker

Problem statement

The date picker does not fully comply with accessibility requirements. Users who rely on assistive technologies may experience frustration or confusion while attempting to interact with the date picker, and users who follow recommended disabled guidance may find it difficult to do so.

Solution

This PR adds a check for the aria-disabled attribute to the toggleCalendar() function, ensuring that the date picker remains discoverable while preventing users from selecting a date when the element is disabled. It also adds the readonly attribute when aria-disabled is used to help the date picker be discoverable by screenreaders. This change aligns with accessibility requirements and simplifies the process for users to follow recommended disabled guidance.

Testing and review

  1. Under 'Date Picker - Range Date' in Storybook, change "Disabled State" to aria-disabled. Refresh page to make change.
  2. Ensure calendar form does not open when calendar icon is clicked
  3. Use a screen reader to test that the toggle button is announced as disabled.

Before opening this PR, make sure you’ve done whichever of these applies to you:

  • Confirm that this code follows the 18F Front End Coding Style Guide and Accessibility Guide.
  • Run git pull origin [base branch] to pull in the most recent updates from your base and check for merge conflicts. (Often, the base branch is develop).
  • Run npm run prettier:sass to format any Sass updates.
  • Run npm test and confirm that all tests pass.
  • Run your code through HTML_CodeSniffer and make sure it’s error free.

@CTGM-Bixal CTGM-Bixal marked this pull request as ready for review August 14, 2024 17:48
@CTGM-Bixal CTGM-Bixal changed the title USWDS - Date Picker: Updated toggleCalendar function to account for aria-disabled attribute USWDS - Date Picker: Updated toggleCalendar function to account for aria-disabled attribute + readonly Aug 14, 2024
Copy link

@alex-hull alex-hull left a comment

Choose a reason for hiding this comment

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

Not yet approving based on observation: Now, this could be a JAWS functionality, as it does not happen in NVDA. When I tab into the calendar icon, while it does tell me it is unavailable, instructions are still announced telling the user to "Press space to activate, use the arrow keys to select". I feel like this could be a bit confusing to the user if they are originally told this is unavailable.

@amycole501
Copy link

NVDA and Narrator don't announce those extra instructions but I can confirm that in JAWS 2024 and Chrome you do hear all those instructions read aloud.

I'm wary of also having a focusable element that is inoperable BUT can't find specific WCAG criteria that sates it's a failure. Since no one can operate the element it's not technically failing any criteria that we can tell.

Copy link
Contributor

@mahoneycm mahoneycm left a comment

Choose a reason for hiding this comment

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

Looks like the calendar functionality is being blocked as expected, but readonly isn't being appended on initialization. Left a couple change requests to address!

@mahoneycm
Copy link
Contributor

NVDA and Narrator don't announce those extra instructions but I can confirm that in JAWS 2024 and Chrome you do hear all those instructions read aloud.

I'm wary of also having a focusable element that is inoperable BUT can't find specific WCAG criteria that sates it's a failure. Since no one can operate the element it's not technically failing any criteria that we can tell.

@amycole501 I believe this would be the intended behavior for aria-disabled buttons. We want them to be discoverable via keyboard but have functionality prevented via javascript.

Copy link
Contributor

@mahoneycm mahoneycm left a comment

Choose a reason for hiding this comment

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

We're getting close! I found a couple blocking issues that should get us to the finish line.

Feel free to reach out if you have any questions!

@mahoneycm
Copy link
Contributor

chore: Could you also create a Site change log entry for this item? Refer to the changelog README and reach out if you have any questions!

Copy link
Contributor

@mejiaj mejiaj left a comment

Choose a reason for hiding this comment

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

Thanks @RachelCorsino.

Testing and review

I was able to test and confirm the following:

  • Input is unclickable in aria-disabled
  • On aria disabled: button shows as dim and unclickable.
  • On aria disabled: I can still enter numbers in the date.

On the last item, is that the intended behavior? You can't click calendar to select date, but you can still enter it manually?

Otherwise LGTM and I can approve once we have clarity on question above and Charlie's changes have been addressed. Thanks again

@CTGM-Bixal
Copy link
Contributor Author

CTGM-Bixal commented Aug 26, 2024

Thanks @RachelCorsino.

Testing and review

I was able to test and confirm the following:

  • Input is unclickable in aria-disabled
  • On aria disabled: button shows as dim and unclickable.
  • On aria disabled: I can still enter numbers in the date.

On the last item, is that the intended behavior? You can't click calendar to select date, but you can still enter it manually?

Otherwise LGTM and I can approve once we have clarity on question above and Charlie's changes have been addressed. Thanks again

@mejiaj - I think that was a mistake on my end with one of the functions. After fixing, the input element does not allow for input.

Copy link
Contributor

@mahoneycm mahoneycm left a comment

Choose a reason for hiding this comment

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

Just a few fine grain details then we should be good to go! Thanks for your persistence @RachelCorsino

@mejiaj mejiaj self-requested a review August 26, 2024 15:58
@CTGM-Bixal CTGM-Bixal requested review from mahoneycm and mejiaj and removed request for mejiaj August 26, 2024 16:05
Copy link
Contributor

@mejiaj mejiaj left a comment

Choose a reason for hiding this comment

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

Thanks @RachelCorsino. Confirming that the aria-disabled button AND input are no longer editable.

Copy link
Contributor

@mahoneycm mahoneycm left a comment

Choose a reason for hiding this comment

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

This is working great! Thanks Rachel!

@mahoneycm mahoneycm requested a review from alex-hull August 28, 2024 14:41
Copy link

@amycole501 amycole501 left a comment

Choose a reason for hiding this comment

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

Sounds good now in JAWS; works as expected.

Copy link
Contributor

@thisisdano thisisdano left a comment

Choose a reason for hiding this comment

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

Thank you!

@thisisdano thisisdano merged commit 17a08cc into develop Oct 3, 2024
@thisisdano thisisdano deleted the rc-prevent-calendar-form-opening-aria-disabled branch October 3, 2024 03:59
@thisisdano thisisdano mentioned this pull request Oct 4, 2024
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.

USWDS - Date Picker: Prevent calendar form opening with aria-disabled

6 participants