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

Improve accessibility of the Warning component in the block editor #67433

Merged
merged 6 commits into from
Dec 19, 2024
12 changes: 10 additions & 2 deletions packages/block-editor/src/components/warning/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@ import { moreVertical } from '@wordpress/icons';
function Warning( { className, actions, children, secondaryActions } ) {
return (
<div style={ { display: 'contents', all: 'initial' } }>
<div className={ clsx( className, 'block-editor-warning' ) }>
<div
className={ clsx( className, 'block-editor-warning' ) }
role="alert"
aria-live="assertive"
sarthaknagoshe2002 marked this conversation as resolved.
Show resolved Hide resolved
tabIndex="0"
>
<div className="block-editor-warning__contents">
<p className="block-editor-warning__message">
{ children }
</p>

{ ( Children.count( actions ) > 0 || secondaryActions ) && (
<div className="block-editor-warning__actions">
<div
className="block-editor-warning__actions"
aria-describedby="block-editor-warning-message"
sarthaknagoshe2002 marked this conversation as resolved.
Show resolved Hide resolved
>
{ Children.count( actions ) > 0 &&
Children.map( actions, ( action, i ) => (
<span
Expand Down
Loading