From a76a5018576c7159ec15310193e1e6b3e592bbdb Mon Sep 17 00:00:00 2001 From: 1Copenut Date: Thu, 7 Mar 2024 19:36:08 -0600 Subject: [PATCH 01/10] Added ARIA role and modal attrs to EuiModal. --- src/components/modal/modal.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/modal/modal.tsx b/src/components/modal/modal.tsx index 18090f91a08..4fd47682482 100644 --- a/src/components/modal/modal.tsx +++ b/src/components/modal/modal.tsx @@ -43,6 +43,11 @@ export interface EuiModalProps extends HTMLAttributes { * Can be a DOM node, or a selector string (which will be passed to document.querySelector() to find the DOM node), or a function that returns a DOM node. */ initialFocus?: HTMLElement | (() => HTMLElement) | string; + /** + * Identifies a modal dialog to screen readers. Modal dialogs that confirm destructive actions + * or need a user's attention should use "alertdialog". + */ + ariaRole?: 'dialog' | 'alertdialog'; } export const EuiModal: FunctionComponent = ({ @@ -51,6 +56,7 @@ export const EuiModal: FunctionComponent = ({ initialFocus, onClose, maxWidth = true, + ariaRole = 'dialog', style, ...rest }) => { @@ -88,6 +94,8 @@ export const EuiModal: FunctionComponent = ({ onKeyDown={onKeyDown} tabIndex={0} style={newStyle} + role={ariaRole} + aria-modal={true} {...rest} > Date: Thu, 7 Mar 2024 19:36:39 -0600 Subject: [PATCH 02/10] Updated Jest snapshots for a11y attrs. --- .../modal/__snapshots__/confirm_modal.test.tsx.snap | 4 ++++ src/components/modal/__snapshots__/modal.test.tsx.snap | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/components/modal/__snapshots__/confirm_modal.test.tsx.snap b/src/components/modal/__snapshots__/confirm_modal.test.tsx.snap index ac5c6906ba4..584687241bb 100644 --- a/src/components/modal/__snapshots__/confirm_modal.test.tsx.snap +++ b/src/components/modal/__snapshots__/confirm_modal.test.tsx.snap @@ -12,8 +12,10 @@ Array [ >