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
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
01c7976
initial commit
rshen91 Feb 7, 2023
9f4968a
Merge remote-tracking branch 'upstream/main' into add-screen-reader-o…
rshen91 Feb 8, 2023
2e133bc
remove change
rshen91 Feb 8, 2023
2b3face
wip
rshen91 Feb 8, 2023
2832e90
wip
rshen91 Feb 8, 2023
0f58ed3
add announcement to createEuiListItem()
rshen91 Feb 9, 2023
ee10330
Merge remote-tracking branch 'upstream/main' into add-screen-reader-o…
rshen91 Feb 9, 2023
5b4c5ac
update i18n
rshen91 Feb 9, 2023
eb455b8
i18n new id
rshen91 Feb 9, 2023
a9d2da8
focusRegionOnTextChange
rshen91 Feb 13, 2023
ac05b30
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Feb 13, 2023
32f682a
Merge remote-tracking branch 'upstream/main' into add-screen-reader-o…
rshen91 Feb 13, 2023
98349d6
Merge remote-tracking branch 'origin/add-screen-reader-only-app-servs…
rshen91 Feb 13, 2023
1bddf50
add different ids for i18n
rshen91 Feb 13, 2023
65dc82c
remove EuiScreenReaderLive from within click evt
rshen91 Feb 14, 2023
226e5e0
update for EuiScreenReaderLive before collapsible nav group
rshen91 Feb 14, 2023
27c4f97
Merge remote-tracking branch 'upstream/main' into add-screen-reader-o…
rshen91 Feb 14, 2023
efd2154
clean up announcement to make more sense
rshen91 Feb 14, 2023
eabd50a
Merge branch 'main' into add-screen-reader-only-app-servs
rshen91 Feb 14, 2023
e79301d
Merge remote-tracking branch 'upstream/main' into add-screen-reader-o…
rshen91 Feb 14, 2023
1e8dc08
Merge remote-tracking branch 'upstream/main' into add-screen-reader-o…
rshen91 Feb 14, 2023
2753aac
update snapshot test
rshen91 Feb 14, 2023
550b2e2
Merge branch 'main' into add-screen-reader-only-app-servs
rshen91 Feb 14, 2023
7ea735b
update snapshot
rshen91 Feb 14, 2023
b487a85
Merge remote-tracking branch 'origin/add-screen-reader-only-app-servs…
rshen91 Feb 14, 2023
e418322
remove old code
rshen91 Feb 14, 2023
4772719
update
rshen91 Feb 14, 2023
3c76b81
Merge branch 'main' into add-screen-reader-only-app-servs
rshen91 Feb 14, 2023
0c69c18
Merge remote-tracking branch 'upstream/main' into add-screen-reader-o…
rshen91 Feb 21, 2023
5a01c32
add euiscreenreaderlive to header.tsx
rshen91 Feb 21, 2023
c81ecd7
update header snapshot test
rshen91 Feb 21, 2023
0b39f1b
Add SR announcements for each page navigation by reacting to breadcru…
cee-chen Feb 21, 2023
5267bc4
Move SR focus region to top of page + add skip to content link
cee-chen Feb 21, 2023
eafab86
snapshot updates
cee-chen Feb 21, 2023
54d9ba4
Merge remote-tracking branch 'upstream/main' into add-screen-reader-o…
rshen91 Feb 22, 2023
3ff1784
Merge branch 'main' into add-screen-reader-only-app-servs
rshen91 Feb 22, 2023
2f5d6df
remove skipToContent for tests passing
rshen91 Feb 22, 2023
a95b3c5
Merge remote-tracking branch 'origin/add-screen-reader-only-app-servs…
rshen91 Feb 22, 2023
8814712
Update packages/core/chrome/core-chrome-browser-internal/src/ui/heade…
rshen91 Feb 22, 2023
0cb69ae
code review
rshen91 Feb 22, 2023
949e7e4
Merge remote-tracking branch origin/add-screen-reader-only-app-servs …
rshen91 Feb 22, 2023
bede3a1
Merge branch 'main' into add-screen-reader-only-app-servs
rshen91 Feb 22, 2023
ae8da0d
header new lines
rshen91 Feb 22, 2023
22701cc
Merge branch 'main' into add-screen-reader-only-app-servs
rshen91 Feb 22, 2023
b555ae2
Merge branch 'main' into add-screen-reader-only-app-servs
rshen91 Feb 22, 2023
193be14
Merge branch 'main' into add-screen-reader-only-app-servs
rshen91 Feb 23, 2023
50eced2
change useEffect hook to useCallback
rshen91 Feb 23, 2023
da83124
Merge remote-tracking branch 'origin/add-screen-reader-only-app-servs…
rshen91 Feb 23, 2023
44cdb72
update snapshot header test
rshen91 Feb 23, 2023
972f4dd
Merge branch 'main' into add-screen-reader-only-app-servs
rshen91 Feb 23, 2023
9a2e43f
revert changes to hook
rshen91 Feb 23, 2023
7f1e9df
Merge remote-tracking branch 'origin/add-screen-reader-only-app-servs…
rshen91 Feb 23, 2023
e6bd3a9
Remove `focusRegionOnTextChange`
cee-chen Feb 23, 2023
87797b9
who was definitely not mutating an array in place? me :|
cee-chen Feb 23, 2023
0629d6b
Revert "Remove `focusRegionOnTextChange`" - for science
cee-chen Feb 23, 2023
84243b4
Skip `focusRegionOnTextChange` behavior only for canvas and discover
cee-chen Feb 24, 2023
65304cd
Account for non-Elastic brand page titles
cee-chen Feb 24, 2023
0489ef4
Merge branch 'main' into add-screen-reader-only-app-servs
rshen91 Feb 24, 2023
1857a06
add a test
rshen91 Feb 24, 2023
0584f62
add more tests
rshen91 Feb 24, 2023
52d555c
beef up some testing
rshen91 Feb 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { HeaderActionMenu } from './header_action_menu';
import { HeaderExtension } from './header_extension';
import { HeaderTopBanner } from './header_top_banner';
import { HeaderMenuButton } from './header_menu_button';
import { ScreenReaderRouteAnnouncements } from './screen_reader_a11y';

export interface HeaderProps {
kibanaVersion: string;
Expand Down Expand Up @@ -108,6 +109,8 @@ export function Header({

cee-chen marked this conversation as resolved.
Show resolved Hide resolved
return (
<>
<ScreenReaderRouteAnnouncements breadcrumbs$={observables.breadcrumbs$} />

<HeaderTopBanner headerBanner$={observables.headerBanner$} />
<header className={className} data-test-subj="headerGlobalNav">
<div id="globalHeaderBars" className="header__bars">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import React, { FC, useState, useEffect } from 'react';
import useObservable from 'react-use/lib/useObservable';
import { EuiScreenReaderLive } from '@elastic/eui';

import type { HeaderProps } from './header';

const DEFAULT_TITLE = 'Elastic'; // This may need to be DRYed out with https://github.com/elastic/kibana/blob/main/packages/core/rendering/core-rendering-server-internal/src/views/template.tsx#L34
const SEPARATOR = ' - ';

export const ScreenReaderRouteAnnouncements: FC<{
breadcrumbs$: HeaderProps['breadcrumbs$'];
}> = ({ breadcrumbs$ }) => {
const [routeTitle, setRouteTitle] = useState('');
const breadcrumbs = useObservable(breadcrumbs$, []);

useEffect(() => {
if (breadcrumbs.length) {
const breadcrumbText: string[] = [];

// Reverse the breadcrumb title order and ensure we only pick up valid strings
breadcrumbs.reverse().forEach((breadcrumb) => {
if (typeof breadcrumb.text === 'string') breadcrumbText.push(breadcrumb.text);
});
breadcrumbText.push(DEFAULT_TITLE);

setRouteTitle(breadcrumbText.join(SEPARATOR));
} else {
// Don't announce anything during loading states
setRouteTitle('');
}
}, [breadcrumbs]);

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.

};