Skip to content

Appender "+" stops working after update to WP 6.8 #70275

@MannyAdumbire

Description

@MannyAdumbire

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.

Image

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

  1. Add the attached block(below) to your theme running on WP 6.8 or higher.
  2. Add a subpages menu block to a page
  3. 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.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] InserterThe main way to insert blocks using the + button in the editing interface[Feature] Nested / Inner BlocksAnything related to the experience of nested/inner blocks inside a larger container, like Group or P[Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions