Skip to content

Commit

Permalink
Block Editor: Revert 'Warning' component autofocus (#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

1 comment on commit d55319c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in d55319c.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12411783825
📝 Reported issues:

Please sign in to comment.