diff --git a/packages/block-library/src/list-item/hooks/use-outdent-list-item.js b/packages/block-library/src/list-item/hooks/use-outdent-list-item.js index 93472f49dbba8d..d4c034b06e8134 100644 --- a/packages/block-library/src/list-item/hooks/use-outdent-list-item.js +++ b/packages/block-library/src/list-item/hooks/use-outdent-list-item.js @@ -20,12 +20,16 @@ export default function useOutdentListItem( clientId ) { const registry = useRegistry(); const { canOutdent } = useSelect( ( innerSelect ) => { - const { getBlockRootClientId } = innerSelect( blockEditorStore ); + const { getBlockRootClientId, getBlockName } = + innerSelect( blockEditorStore ); const grandParentId = getBlockRootClientId( getBlockRootClientId( clientId ) ); + const grandParentName = getBlockName( grandParentId ); + const isListItem = grandParentName === listItemName; + return { - canOutdent: !! grandParentId, + canOutdent: isListItem, }; }, [ clientId ] diff --git a/test/e2e/specs/editor/blocks/list.spec.js b/test/e2e/specs/editor/blocks/list.spec.js index 1e4960dc335be9..3e5b79cc60c8ed 100644 --- a/test/e2e/specs/editor/blocks/list.spec.js +++ b/test/e2e/specs/editor/blocks/list.spec.js @@ -600,6 +600,32 @@ test.describe( 'List', () => { ); } ); + test( 'should create paragraph on Enter in quote block', async ( { + editor, + page, + } ) => { + await editor.insertBlock( { name: 'core/quote' } ); + await page.keyboard.type( '/list' ); + await page.keyboard.press( 'Enter' ); + await page.keyboard.type( 'aaa' ); + await page.keyboard.press( 'Enter' ); + await page.keyboard.press( 'Enter' ); + + await expect.poll( editor.getEditedPostContent ).toBe( + ` +
+ + + + +

+
+` + ); + } ); + test( 'should indent and outdent level 1', async ( { editor, page } ) => { await editor.insertBlock( { name: 'core/list' } ); await page.keyboard.type( 'a' );