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

[Accessibility] Route changes announcement #150461

Merged
merged 61 commits into from
Feb 24, 2023

Conversation

rshen91
Copy link
Contributor

@rshen91 rshen91 commented Feb 7, 2023

Summary

Closes #149212 and closes #149213

This PR was tested with VoiceOver on Safari, Firefox and Chrome.

Checklist

@rshen91 rshen91 changed the title [Accessibility] Route changes announcement through EuiScreenReaderLive [Accessibility] Route changes announcement Feb 8, 2023
@rshen91 rshen91 self-assigned this Feb 8, 2023
@rshen91 rshen91 marked this pull request as ready for review February 13, 2023 20:39
@rshen91 rshen91 requested a review from a team as a code owner February 13, 2023 20:39
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-accessibility (Project:Accessibility)

@rshen91 rshen91 requested a review from cee-chen February 13, 2023 20:39
@rshen91 rshen91 added the release_note:skip Skip the PR/issue when compiling release notes label Feb 13, 2023
@1Copenut 1Copenut self-requested a review February 13, 2023 20:41
@rshen91 rshen91 requested a review from vadimkibana February 13, 2023 20:42
Comment on lines 189 to 199
onClick(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) {
if (event.button === 0 && !isModifiedOrPrevented(event)) {
event.preventDefault();
<EuiScreenReaderLive focusRegionOnTextChange>
{i18n.translate('core.ui.recentLinks.linkItem.screenReaderAnnouncement.title', {
defaultMessage: 'type: {title}',
values: {
title: navLink?.title,
},
})}
</EuiScreenReaderLive>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this usage of <EuiScreenReaderLive> within an onClick event is correct - it's not clear that it's actually rendering anywhere meaningful.

Instead of making the screen reader announcement imperative (e.g. firing on click), I think you need to make it reactive (e.g. responding to document.title changes, which it then stores in state), and only located in 1 place across all apps. Does that make sense? Happy to chat more if not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll plus one to @cee-chen about responding to document.title and having this centrally located. I've experienced NVDA announce changes inconsistently when the live region is added late. Having it in the DOM on first render() and then update with document.title should give a consistent experience.

Copy link
Contributor Author

@rshen91 rshen91 Feb 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thank you both! I think I'm following - updated in 226e5e0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feb-14-2023.10-25-32.mp4

- let's see if this fixes FTR shenanignas
@@ -38,5 +38,5 @@ export const ScreenReaderRouteAnnouncements: FC<{
}
}, [breadcrumbs]);

return <EuiScreenReaderLive focusRegionOnTextChange>{routeTitle}</EuiScreenReaderLive>;
return <EuiScreenReaderLive aria-live="assertive">{routeTitle}</EuiScreenReaderLive>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1Copenut I set aria-live to assertive to make up for the removed focus behavior - not sure if this was the right move or is overly aggressive. Do you mind testing? 🙇

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from my testing: it works maybe 75% of the time on Safari+VO but not 100% of the time (for whatever reason, no idea why). Would feel better if we had JAWS and NVDA data.

@cee-chen
Copy link
Contributor

cee-chen commented Feb 23, 2023

lmfao ok i figured out the other FTR failures. .reverse() mutates the array in place and as such I was mutating the observed breadcrumbs array for every other app. please fire me from a cannon into the sun

I am incredibly curious about whether it's just Canvas that throws after I fix that issue though, so I'm going to re-re-revert focusRegionOnTextChange to see what happens / how many FTR tests fail after that. Apologies for this trash fire of a commit history

@cee-chen
Copy link
Contributor

cee-chen commented Feb 24, 2023

Failures now appear to be limited to Canvas and Discover (since discover has custom h1 focusing logic). Super dumb one-off workarounds here we go!

@rshen91 rshen91 enabled auto-merge (squash) February 24, 2023 14:17
@rshen91 rshen91 disabled auto-merge February 24, 2023 14:17
@rshen91 rshen91 enabled auto-merge (squash) February 24, 2023 14:17
@rshen91 rshen91 disabled auto-merge February 24, 2023 14:35
@1Copenut
Copy link
Contributor

I did further testing on the morning of 24 February with Safari + VoiceOver. The latest changes are solid and behavior matches what I've experienced in other live-region testing.

Safari + VO has a tendency to not announce a live region the first time it loads a view with a lot of async data and/or JS rendering, but I've witnessed that before. It also tends to smooth out when the view is loaded subsequently. I expect we'll get more consistent results with NVDA and JAWS. I'll do more testing with those screen readers as time permits.

Cee mentioned that Canvas is dynamically rebuilding the breadcrumbs as users rename the workpad. There's code in the PR to ignore this, but I was still able to trigger the live region as I edited a workpad. Let me know if I should pull code again and retest this behavior. I don't consider this worth holding up the PR--it's actually an opportunity to improve the Canvas renaming behavior with a "Save" or "Go" button.

I'll add a ticket for the Discover app to remove our earlier H1 focus workaround and point to this PR.

Much appreciated!

/cc @rshen91 @cee-chen

@rshen91 rshen91 enabled auto-merge (squash) February 24, 2023 16:44
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
core 414 415 +1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 350.2KB 350.8KB +557.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @rshen91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Project:Accessibility release_note:skip Skip the PR/issue when compiling release notes v8.8.0
Projects
None yet
8 participants