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

Update Alert role #132

Open
huyenltnguyen opened this issue May 15, 2024 · 0 comments
Open

Update Alert role #132

huyenltnguyen opened this issue May 15, 2024 · 0 comments
Labels
scope: a11y Threads for addressing accessibility issues. status: discussing Under discussion threads. Closed as stale after 60 days of inactivity.

Comments

@huyenltnguyen
Copy link
Member

Description

The Alert component always has the alert role:

<div className={classes} role="alert" {...props}>

However, the alert role is quite disruptive to non-sighted users. The role is equivalent to setting aria-live="assertive", which interrupts the user's current task and announces the message immediately. For this reason, the role should only be used for time-sensitive messages, typically error messages.

I'd propose that we change the component's role as follows:

  • role is alert if the variant is danger
  • role is status if the variant is info, success, or warning

Additionally, we should consider creating a separate component for callout boxes:

Screenshots
Variant Screenshot
Info Screenshot 2024-05-15 at 14 23 32
Danger Screenshot 2024-05-15 at 14 26 03

We're using Alert for those messages (to achieve consistent styles), but I think the content of those boxes should be read as part of the page content, rather than as a notification / alert.

The new callout component can have the same set of variants that Alert has, but renders its content in a plain div, without any roles.

References

@huyenltnguyen huyenltnguyen added status: discussing Under discussion threads. Closed as stale after 60 days of inactivity. scope: a11y Threads for addressing accessibility issues. labels May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: a11y Threads for addressing accessibility issues. status: discussing Under discussion threads. Closed as stale after 60 days of inactivity.
Projects
None yet
Development

No branches or pull requests

1 participant