Skip to content

Conversation

taysea
Copy link
Collaborator

@taysea taysea commented Dec 14, 2022

What does this PR do?

This updates our approach to marking required fields with a required indicator. Previously, we relied on aria-label to put a "required" string on the * span. However, certain screen readers like JAWS/NVDA do not read aria-labels on spans. This takes an improved approach (mirroring an approach Bootstrap has taken) to include "required" in the DOM but keeping it only visible for screen readers.

This PR only addresses this behavior for themes that currently have requiredIndicator set to true. A subsequent PR will figure out how to handle for all cases.

Where should the reviewer start?

What testing has been done on this PR?

Tested with VoiceOver and JAWS.

JAWS output
Screen Shot 2022-12-14 at 2 44 51 PM

How should this be manually tested?

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • userEvent is used in place of fireEvent.
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

What are the relevant issues?

Relates to #6524

Screenshots (if appropriate)

Do the grommet docs need to be updated?

No.

Should this PR be mentioned in the release notes?

Yes. Improved screen reader support for required form fields.

Is this change backwards compatible or is it a breaking change?

Backwards compatible.

@taysea taysea requested a review from jcfilben December 14, 2022 22:24
@taysea taysea marked this pull request as draft December 14, 2022 22:44
@taysea taysea marked this pull request as ready for review December 14, 2022 22:45
Copy link
Collaborator

@jcfilben jcfilben 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!

@ericsoderberghp ericsoderberghp merged commit 8ff912b into grommet:master Dec 19, 2022
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.

3 participants