Skip to content

Content only mode - make block navigation more consistent #50365

Open
@talldan

Description

What problem does this address?

In contentOnly mode, there are some inconsistencies with how users navigate blocks:

  • Breadcrumbs show all blocks within the template, even those that don't have content
  • List View only shows the parent locked block
  • The parent block selector is missing

To test this try inserting the following block markup using code editor mode:

<!-- wp:group {"templateLock":"contentOnly","layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:heading -->
<h2 class="wp-block-heading">Test heading</h2>
<!-- /wp:heading -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:paragraph -->
<p>Column A</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:paragraph -->
<p>Column B</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>List 1</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>List 2</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>List 3</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list --></div>
<!-- /wp:group -->

Observe that when selecting the text in a list or a column, the list and column(s) blocks can still be accessed using the breadcrumbs - the expectation is that they'd be hidden given they're non-content blocks.

What is your proposed solution?

  • Breadcrumbs - Hide non content blocks in the content only template (this seems like an oversight that can be fixed straight away)
  • List View - Show content only blocks as flattened children like @noisysocks explored in Add ability to set templateLock = 'contentOnly' in editor settings #50082. My reasoning for this is that users may or may not have both List View and the Inspector open at the same time, it'd be good to have consistent navigation in both places. Otherwise users have to jump between List View and the Inspector for the same task.
  • Parent block selector - my idea is to bring this back, but make it bypass non-content blocks. I guess the reason its missing is that it could be confused for the block icon? Maybe it's not completely straightforward 😄

Metadata

Assignees

No one assigned

    Labels

    [Feature] Block LockingThe API allowing for the ability to lock/unlock blocks[Type] EnhancementA suggestion for improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions