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
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
19 changes: 17 additions & 2 deletions packages/block-editor/src/components/warning/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,28 @@ import clsx from 'clsx';
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { moreVertical } from '@wordpress/icons';
import { useEffect, useRef } from '@wordpress/element';

function Warning( { className, actions, children, secondaryActions } ) {
const alertRef = useRef( null );

useEffect( () => {
if ( null !== alertRef.current ) {
alertRef.current.focus();
}
}, [] );
sarthaknagoshe2002 marked this conversation as resolved.
Show resolved Hide resolved
return (
<div style={ { display: 'contents', all: 'initial' } }>
<div className={ clsx( className, 'block-editor-warning' ) }>
<div
className={ clsx( className, 'block-editor-warning' ) }
tabIndex="0"
>
<div className="block-editor-warning__contents">
<p className="block-editor-warning__message">
<p
className="block-editor-warning__message"
ref={ alertRef }
sarthaknagoshe2002 marked this conversation as resolved.
Show resolved Hide resolved
role="alert"
>
{ children }
</p>

Expand Down
16 changes: 8 additions & 8 deletions packages/upload-media/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
},
"include": [ "src/**/*" ],
"references": [
{ "path": "../api-fetch" },
sarthaknagoshe2002 marked this conversation as resolved.
Show resolved Hide resolved
{ "path": "../blob" },
{ "path": "../compose" },
{ "path": "../data" },
{ "path": "../element" },
{ "path": "../i18n" },
{ "path": "../private-apis" },
{ "path": "../url" }
{ "path": "../api-fetch" },
{ "path": "../blob" },
{ "path": "../compose" },
{ "path": "../data" },
{ "path": "../element" },
{ "path": "../i18n" },
{ "path": "../private-apis" },
{ "path": "../url" }
]
}
Loading