Skip to content

Commit

Permalink
Block Editor: Revert 'Warning' component autofocus (WordPress#68133)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: getdave <[email protected]>
  • Loading branch information
3 people authored Dec 19, 2024
1 parent 12cb6a0 commit d55319c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
14 changes: 1 addition & 13 deletions packages/block-editor/src/components/warning/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,11 @@ 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 (
<div style={ { display: 'contents', all: 'initial' } }>
<div
className={ clsx( className, 'block-editor-warning' ) }
tabIndex="0"
ref={ alertRef }
role="alert"
>
<div className={ clsx( className, 'block-editor-warning' ) }>
<div className="block-editor-warning__contents">
<p className="block-editor-warning__message">
{ children }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ exports[`Warning should match snapshot 1`] = `
>
<div
class="block-editor-warning"
role="alert"
tabindex="0"
>
<div
class="block-editor-warning__contents"
Expand Down

0 comments on commit d55319c

Please sign in to comment.