Skip to content

Commit

Permalink
Fix: OffCanvasEditor does not inserts submenu on collapsed items. (#4…
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta authored Feb 20, 2023
1 parent aa1fca2 commit b2c16f3
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { __, sprintf } from '@wordpress/i18n';
*/
import { store as blockEditorStore } from '../../store';
import BlockTitle from '../block-title';
import { useListViewContext } from './context';

const POPOVER_PROPS = {
className: 'block-editor-block-settings-menu__popover',
Expand All @@ -30,6 +31,7 @@ const BLOCKS_THAT_CAN_BE_CONVERTED_TO_SUBMENU = [
];

function AddSubmenuItem( { block, onClose } ) {
const { expandedState, expand } = useListViewContext();
const { insertBlock, replaceBlock, replaceInnerBlocks } =
useDispatch( blockEditorStore );

Expand Down Expand Up @@ -74,6 +76,9 @@ function AddSubmenuItem( { block, onClose } ) {
updateSelectionOnInsert
);
}
if ( ! expandedState[ block.clientId ] ) {
expand( block.clientId );
}
onClose();
} }
>
Expand Down

1 comment on commit b2c16f3

@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 b2c16f3.
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/4224958605
📝 Reported issues:

Please sign in to comment.