nextcloud-dialogs icon indicating copy to clipboard operation
nextcloud-dialogs copied to clipboard

Improve toast accessibility

Open skjnldsv opened this issue 10 months ago • 4 comments

Some suggestions:

1. State the type of message

Announcing the type first (like "Error: [message]"), this is generally a good practice:

  • It immediately communicates the severity to screen reader users
  • It helps users mentally prepare for the information
  • It provides context similar to how visual users get from the colors/icons
<div aria-live="assertive" aria-atomic="true">
  <span class="visually-hidden">Error:</span>
  <p>Your form submission failed. Please try again.</p>
</div>

2. Use role="alert"

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role For stronger levels like error or warning, I think this fits the use case

skjnldsv avatar Feb 28 '25 16:02 skjnldsv

@ShGKme @susnux

skjnldsv avatar Feb 28 '25 16:02 skjnldsv

Seems possible by wrapping toast methods to provide a custom node option.

ShGKme avatar Feb 28 '25 18:02 ShGKme

We can also improve the lib itself 😉

skjnldsv avatar Mar 06 '25 15:03 skjnldsv

Or move away from it completely and implement our own NcToast for it^^

susnux avatar Mar 06 '25 16:03 susnux