From 7cdbe078cf052f30d11c659264fb0da2447719ff Mon Sep 17 00:00:00 2001 From: Cee Chen <549407+cee-chen@users.noreply.github.com> Date: Thu, 2 Feb 2023 16:51:19 -0800 Subject: [PATCH] [EuiFlyout] Include all fixed `EuiHeader`s in flyout focus traps + improve screen reader accessibility (#6566) * EuiFlyout - auto-shard all fixed EuiHeaders NOT YET WORKING: autoFocus on flyout open and returnFocus * Fix flyouts toggled from header shards not correctly focusing headers + a11y improvement: mirroring popovers & modals, make the flyout wrapper focusable via `tabIndex={0}`, so that screen readers take out a beat to read out the `labelledby` and (upcoming `describedby`) instead of jumping to the close button or the first focusable child (if no close button exists) * Add screen reader instructions on interacting with the flyout - allow for custom `role`s that consumers pass in that aren't `dialog`s (likely very rare, may need more testing) * Deprecate `closeButtonAriaLabel` - use `closeButtonProps['aria-label']` instead * [chore] Remove Fragment * Write tests for new EuiHeader affordance & screen reader instructions * [PR feedback] Remove `role` prop customization, tweak SR text accordingly --- .../collapsible_nav.test.tsx.snap | 85 ++++- .../collapsible_nav/collapsible_nav.tsx | 4 +- .../flyout/__snapshots__/flyout.test.tsx.snap | 324 ++++++++++++++---- src/components/flyout/flyout.spec.tsx | 77 ++++- src/components/flyout/flyout.test.tsx | 63 ++-- src/components/flyout/flyout.tsx | 124 +++++-- .../header/__snapshots__/header.test.tsx.snap | 1 + src/components/header/header.tsx | 6 +- upcoming_changelogs/6566.md | 7 + 9 files changed, 540 insertions(+), 151 deletions(-) create mode 100644 upcoming_changelogs/6566.md diff --git a/src/components/collapsible_nav/__snapshots__/collapsible_nav.test.tsx.snap b/src/components/collapsible_nav/__snapshots__/collapsible_nav.test.tsx.snap index bae474c35c2..933e1e56d3d 100644 --- a/src/components/collapsible_nav/__snapshots__/collapsible_nav.test.tsx.snap +++ b/src/components/collapsible_nav/__snapshots__/collapsible_nav.test.tsx.snap @@ -12,11 +12,20 @@ Array [ data-focus-lock-disabled="false" >