Description
The "+" block appender button no longer shows up on a custom block, after updating to WordPress 6.8.
Reverting the core update restores the ability to add navigation links.
I tested adding 'core/paragraph', to the allowedBlocks returned in BlockEdit's inner blocks - this restores the appender button on mouse hover, BUT clicking on the button still does nothing.
No other blocks appear to have been affected, except this custom block.
Any insights or suggestions on how to manually restore the ability to add navigation links will be much appreciated!
Step-by-step reproduction instructions
- Add the attached block(below) to your theme running on WP 6.8 or higher.
- Add a subpages menu block to a page
- Within the subpages menu, try to add navigation links.
subpages-menu-block.zip
Screenshots, screen recording, code snippet
No response
Environment info
The issue happens in WordPress 6.8
It does not happen in WordPress 6.7.2
in index.js:
import { registerBlockType } from '@wordpress/blocks';
import { InnerBlocks } from '@wordpress/block-editor';
import { BlockEdit } from './edit';
import metadata from './block.json';
registerBlockType(metadata, {
edit: BlockEdit,
save: () => <InnerBlocks.Content />,
});
in edit.js:
export const BlockEdit = (props) => {
const { setAttributes, clientId, context, name } = props;
const { postId, postType } = context;
const blockProps = useBlockProps();
const innerBlocksProps = useInnerBlocksProps(
{},
{
allowedBlocks: ['core/navigation-link', 'core/navigation-submenu'],
},
);
const { blockCount } = useSelect((select) => {
const { getBlockCount } = select('core/editor');
return {
blockCount: getBlockCount(clientId),
};
}, []);
const currentEditedMeta = useSelect(
(select) => select('core/editor').getEditedPostAttribute('meta'),
[],
);
const postParentId = useSelect(
(select) => select('core/editor').getEditedPostAttribute('parent'),
[],
);
const inheritFromParent = postParentId ? currentEditedMeta.inherit_from_parent : false;
useEffect(() => {
if (!IsRevision()) {
setAttributes({ currentPostId: postId });
}
}, [postId, setAttributes]);
return (
<div {...blockProps}>
<InnerBlocks
tagName="ul"
allowedBlocks={[
'core/paragraph',
'core/navigation-link',
'core/navigation-submenu'
]}
defaultBlock={['core/navigation-link', {}]}
directInsert
/>
</div>
);
};
in block.json:
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "org/subpages-menu",
"title": "Subpages menu",
"category": "theme",
"icon": "menu",
"description": "Display a subpages menu that can be shared with child pages. On RCILs, this also displays the logo.",
"attributes": {
"currentPostId": {
"type": "integer"
},
"postParentId": {
"type": "integer",
"default": 0
},
"inheritFromParent": {
"type": "boolean",
"default": false
},
"isServerPreview": {
"type": "boolean",
"default": false
}
},
"usesContext": [
"postId",
"postType"
],
"supports": {
"html": false,
"multiple": false
},
"textdomain": "org-theme",
"editorScript": "file:./index.js",
"editorStyle": "file:./editor-style.css",
"viewScript": "file:./subpages-menu.js",
"style": "file:./style.css",
"render": "file:./markup.php"
}
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
Description
The "+" block appender button no longer shows up on a custom block, after updating to WordPress 6.8.
Reverting the core update restores the ability to add navigation links.
I tested adding
'core/paragraph',to theallowedBlocksreturned inBlockEdit's inner blocks - this restores the appender button on mouse hover, BUT clicking on the button still does nothing.No other blocks appear to have been affected, except this custom block.
Any insights or suggestions on how to manually restore the ability to add navigation links will be much appreciated!
Step-by-step reproduction instructions
subpages-menu-block.zip
Screenshots, screen recording, code snippet
No response
Environment info
The issue happens in WordPress 6.8
It does not happen in WordPress 6.7.2
in
index.js:in
edit.js:in
block.json:Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.