Regression bugs when post type template_lock = 'contentOnly'
Description
With Gutenberg 15.1.1 active when the template_lock of a post type template is set to 'contentOnly', the expected behaviour is no longer as it was with WP 6.1.1. with the Gutenberg plugin deactivated. The content lock functionality is broken.
Step-by-step reproduction instructions
See code sample. Add it to your theme functions.php Add a new Book and try to edit the content of the paragraphs, e.g:
- if you click on a paragraph block the group is always selected (the child should be selected)
- if you click in the inspector in the content panel on a child paragraph the cursor is placed in the block but you cannot reposition the cursor
- if you click in the inspector in the content panel on a child paragraph the regular inspector panels show (they shouldn't)
- you can move the child block (shouldn't be possible)
Screenshots, screen recording, code snippet
<?php
function register_books_post_type() {
$labels = array(
'name' => __( 'Books', 'text-domain' ),
'singular_name' => __( 'Book', 'text-domain' ),
'menu_name' => __( 'Books', 'text-domain' ),
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_rest' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'books' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'template' => array(
array(
'core/group',
array(),
array(
array(
'core/paragraph',
array(
'placeholder' => 'Book Description - Paragraph 1',
'content' => 'This is the first paragraph of the book description. 1',
)
),
array(
'core/paragraph',
array(
'placeholder' => 'Book Description - Paragraph 2',
'content' => 'This is the second paragraph of the book description.',
)
),
)
),
),
'template_lock' => 'contentOnly',
);
register_post_type( 'books', $args );
}
add_action( 'init', 'register_books_post_type' );
Environment info
Wordpress 6.1.1 with Gutenberg 15.1.1. active
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
@BennyVL Thanks for the report.
I will investigate this issue in the near future, but I have formatted the code in your comment once so that more people can test this issue.
if you click on a paragraph block the group is always selected (the child should be selected) if you click in the inspector in the content panel on a child paragraph the cursor is placed in the block but you cannot reposition the cursor if you click in the inspector in the content panel on a child paragraph the regular inspector panels show (they shouldn't) you can move the child block (shouldn't be possible)
I was able to reproduce this problem with WordPress 6.2-beta3-55402. It occurs both when the Gutenberg plugin is enabled and when it is disabled.
https://user-images.githubusercontent.com/54422211/220641538-afaea290-fe33-4a7c-af9a-bea8ef31eead.mp4
WordPress 6.1.1 shows the expected UI as follows


@Mamaduka fyi
@kevin940726 could you perhaps dig in here since you've done so much around exploring content lock for patterns?
I'm not sure TBH! This looks like it's about template's contentOnly but not group's contentOnly. I can try looking into it, but maybe someone else with more knowledge over that area would figure it out faster than me 😅 .