-
Notifications
You must be signed in to change notification settings - Fork 841
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
WIP: [Accessibility] Make toast global list is an aria live region #1958
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small change. You need a changelog.
…ment as a part of title; make it working in NVDA
…ment as a part of title; make it working in NVDA
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but please review my comments above.
@rockfield I tried to test this on Friday and you are correct. I am not sure whats happening with this on voiceover. Buzzing a developer today and then will update my review. Thanks! |
@bhavyarm, I've updated the algorithm with the following technique: after the 57 sec of idle, it clears the stack of toast notifications. |
@maryia-lapata could you confirm that we checked with VoiceOver and it works perfectly? |
@bhavyarm I've re-implemented the algorithm of updating sound announcing, now as I see it works perfectly with VoiceOver as well as with NVDA and Jaws. |
yes, we checked with VoiceOver (Mac 10.14.5). It works as expected (see "Expected behaviour" section on the description.) |
// where one of them has number ID while the other -- string | ||
// Also, documentation example uses numberic IDs | ||
const toastIDS = toasts | ||
.filter(({ id }) => typeof id === 'number') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cjcenizal @snide @thompsongl @cchaos @rockfield
I think it makes sense to discuss this solution. This solution works only for numeric id's. I see some risk here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cjcenizal @snide @thompsongl @cchaos
The main question and issue here are how could I catch the last came toast?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so I'm sure I understand correctly: is the goal of lines 194-198 to determine the newest toast in the toasts
array? If so, then does toasts[toasts.length - 1]
give us that information?
I agree with @alexwizp that depending upon numeric IDs is risky. AFAIK, there's nothing enforcing numeric IDs, or even a meaningful relationship between IDs that are numeric (e.g. that higher numbers mean the toast is newer or anything else). I think relying on a convention will be very easy to break and difficult for consumers to debug if they stray from it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed this over a zoom call and have a plan to move forward with a more nuanced approach.
id: toast.id, | ||
reactElement: ( | ||
<Fragment key={toast.id}> | ||
<p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❔ For accessibility, would it make sense to give this an aria-title
pointing to the thing below that has the toast.title
ditto for aria-describedby
and the toast text?
…t re-announcing that from screen reader
This became too huge, complex and outdated. Please, have a look at that a few lines PR: #2055 |
Closes #1947
Summary
This PR aims to implement correctly live regions as a toast global list in Eui and Kibana app.
Toasts are stored as
<p>
nodes in an aria live region.Every next toast replace a previous one with short "clearing-delay" which tells ScreenReader that there is a change that needs to be announced.
Every toast has
aria-live
attribute, there is no live region at all.It does work: VoiceOver
It doesn't work: NVDA, JAWS.
✅ Now
A live region
role="region"
initializes at the component mounting,next to globalToastList, — it is a div that is going to contains all upcoming notifications as a
<p>
nodes.Thus the Screen Reader understands where it should wait for updates.
Have a look at #1947 issue's description, there are a couple of links to standard explanations.
It does work: VoiceOver, NVDA, JAWS
It doesn't work: n/a
Expected behaviour
Once a toast notification is rendered, it is getting be announced.
At the moment of the next toast coming, Screen Reader stops saying and is starting announce the coming one.
Tasks to do in this PR
Checking against ScreenReaders
✅ VoiceOver + Safari
✅ NVDA + Firefox
✅ NVDA + IE11
✅ Narrator + Edge
✅ NVDA + Chrome
Checklist
- [ ] This was checked in mobile- [ ] Any props added have proper autodocs- [ ] Documentation examples were added- [ ] This was checked for breaking changes and labeled appropriately- [ ] This required updates to Framer X components