diff --git a/packages/block-editor/src/components/warning/index.js b/packages/block-editor/src/components/warning/index.js index 17a014107b43a..628a17d4f4789 100644 --- a/packages/block-editor/src/components/warning/index.js +++ b/packages/block-editor/src/components/warning/index.js @@ -9,11 +9,23 @@ 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(); + + useEffect( () => { + alertRef.current?.focus(); + }, [] ); + return (
-
+

{ children } diff --git a/packages/block-editor/src/components/warning/test/__snapshots__/index.js.snap b/packages/block-editor/src/components/warning/test/__snapshots__/index.js.snap index dbaba10e18efe..57c384fab28ba 100644 --- a/packages/block-editor/src/components/warning/test/__snapshots__/index.js.snap +++ b/packages/block-editor/src/components/warning/test/__snapshots__/index.js.snap @@ -7,6 +7,8 @@ exports[`Warning should match snapshot 1`] = ` >