Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content only mode - make block navigation more consistent #50365

Open
2 of 3 tasks
talldan opened this issue May 5, 2023 · 5 comments
Open
2 of 3 tasks

Content only mode - make block navigation more consistent #50365

talldan opened this issue May 5, 2023 · 5 comments
Labels
[Feature] Block Locking The API allowing for the ability to lock/unlock blocks [Type] Enhancement A suggestion for improvement.

Comments

@talldan
Copy link
Contributor

talldan commented May 5, 2023

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 😄
@talldan talldan added [Type] Enhancement A suggestion for improvement. Needs Design Feedback Needs general design feedback. [Feature] Block Locking The API allowing for the ability to lock/unlock blocks labels May 5, 2023
@noisysocks
Copy link
Member

Agree on all 3!

@jasmussen
Copy link
Contributor

The third one, I'd move a little more carefully with. GIF for context, showing clicking around the test content:

testing

The parent button was intentionally removed because contentOnly is meant to be that much simpler of an interface for selecting and interacting with blocks, one where you don't have to select particular "layers", such as in this example, the individual columns. To an extent, you could see the contentOnly mode as an editorial tool to lock down pieces that are not meant to be interacted with.

The more pressing issue is that the list view is intentionally flattened as well, and the content panel is curated. If we allow access to selecting the column through a parent block, that could be a bit confusing.

@talldan
Copy link
Contributor Author

talldan commented May 8, 2023

To an extent, you could see the contentOnly mode as an editorial tool to lock down pieces that are not meant to be interacted with.

I think it'd be good to make it work that way as much as possible. A challenge is that it's difficult to enforce what users and extenders do. For example, we can't control when a user has a content locked parent block that's nested in another non-locked block. Unfortunately contentOnly is already released with support for that. In that situation a user may be confused as to why they can't select a parent. It's also a very common way to use existing templateLock features, combining different types of restrictions in one template.

The other thing that I find confusing is that the block icon is missing from the toolbar, yet it's visible in the 'content' sidebar.

The more pressing issue is that the list view is intentionally flattened as well

I'm interpreting this to mean not showing the contentOnly locked group at all, but instead showing the content blocks, is that the right assumption? Should the locked parent be impossible to select in the canvas too?

If we allow access to selecting the column through a parent block, that could be a bit confusing.

This isn't something being proposed. This issue proposes the opposite, that we remove support for selecting things like columns in a contentOnly locked template. Currently it's possible through breadcrumbs.

@jasmussen
Copy link
Contributor

This isn't something being proposed. This issue proposes the opposite, that we remove support for selecting things like columns in a contentOnly locked template. Currently it's possible through breadcrumbs.

Oh, I'm being silly then, apologies. Would definitely agree to removing that.

@noisysocks
Copy link
Member

#50643 addressed 2 of these points. I'll check them off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block Locking The API allowing for the ability to lock/unlock blocks [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants