components icon indicating copy to clipboard operation
components copied to clipboard

Improve accessibility of inline message

Open anna-lach opened this issue 1 year ago • 5 comments

According to Michael's question from Sprint review (05.03.2024) we need to improve accessibility of the inline message component. First we need to make some research again. The main problem is when using 'role' in the component all the content is read by default by a Screen Reader, even a close button, which ideally should be written only when it gets focus - when user navigates to it, not by default.

image

More details: https://sanoma.slack.com/archives/C03SA9HUUA3/p1709649841422769

### Tasks

anna-lach avatar Mar 06 '24 08:03 anna-lach

Maybe some helpful information can be found here: https://carbondesignsystem.com/components/notification/accessibility#how-it-works

image

anna-lach avatar Mar 06 '24 09:03 anna-lach

  1. Try with moving role to the 'content' element - there might be a problem with Screen Readers and shadow DOM
  2. Maybe we will need a kind of Announcer https://dev.to/steady5063/aria-live-in-javascript-frameworks-4f9p that people can use in their apps

We need to finish the discussion next time.

anna-lach avatar Mar 22 '24 11:03 anna-lach

Discuss with Anna Karon

DanielleRameau avatar Aug 21 '24 08:08 DanielleRameau

I've review this component and currently I see following issues:

  1. the message is not announced to the screen reader, because live region (role="alert", role="status", aria-live attribute ) is injected into the page when the message appears. It should be added to the container before the message appears.
  2. Live region doesn’t handle rich text. so the "button" element won't be announced. only the Label of the button.
  3. I didn't find option to not announce a part of the element injected to the live region. For sure some trick can be use but I'm not sure if we should heading the tricky way.
  4. The next important question: does notification message should have the "Close" button (or any other action)?

According to the ARIA specification:

Authors SHOULD ensure an element with role status does not receive focus as a result of change in status. […] Neither authors nor user agents are required to set or manage focus to an alert in order for it to be processed. Since alerts are not required to receive focus, authors SHOULD NOT require users to close an alert. If an author desires focus to move to a message when it is conveyed, the author SHOULD use alertdialog instead of alert.

If we remove the "Close" button, and it disappears after for example ~500ms, will it be still accessible for users with cognitive limitation who need more time to access the information?

If we move focus, how we can ensure that user go back to the previous action after closing the message?

I feel like it requires more discussion to find the best usable solution for all users (mouse, keyboard, assistive technologies etc).

I share here 2 great articles with complex explanation what is live region how and when to use it:

anqaka avatar Sep 25 '24 13:09 anqaka