WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.51k stars 4.2k forks source link

Template part selecting and editing unavailable in “Write” mode #66463

Open annezazu opened 2 weeks ago

annezazu commented 2 weeks ago

When the editor is set to “Design” mode, users can select template parts, which renders an “Edit” button allowing isolated editing of the template part. However, this functionality is unavailable in “Write” mode.

But if you enter the editor, turn on write mode, and open list view, template parts aren't visible in the list view nor can you edit them. I can replicate this with Twenty Twenty-Five, as well as other block themes with both 6.7 trunk & Gutenberg trunk on:

https://github.com/user-attachments/assets/50bfdd22-c85d-4138-be23-81ed0e307b33

annezazu commented 6 days ago

Noting that this includes if you switch between Write and Design modes. If you enter Write mode, it completely removes the ability to select template parts in list View even after switching to Design mode, even though you can select them. This is a demo with GB 19.6:

https://github.com/user-attachments/assets/d1d11ac5-59be-405d-9278-5aba7b8f38e7

ntsekouras commented 6 days ago

Hm.. I can't reproduce on trunk. @annezazu can you test in trunk too? I'll keep digging a bit more though to see if there was a PR that fixed that..

xavier-lc commented 6 days ago

I've been able to replicate what @annezazu describes on a simple edge site using v19.6.0:

  1. Go to /wp-admin/site-editor.php
  2. Click on Templates
  3. Click on a template
  4. The editor opens in Write mode
  5. The header and footer are not shown on the List View
  6. Switch to Design mode
  7. Reload the page
  8. Now I can interact with header/footer, and they are shown on the list view

https://github.com/user-attachments/assets/3daf53b4-2146-4dfc-994f-86d3e8847c6b

xavier-lc commented 6 days ago

Replicated as well on a simple site running v19.5.1:

https://github.com/user-attachments/assets/d6eb58f3-fadf-4c79-8e50-0af515b395a0

xavier-lc commented 6 days ago

I've downgraded my simple edge site to v19.4.0 and there I can see that the content of the list view changes when switching between write/design modes:

https://github.com/user-attachments/assets/519cb162-4c8e-4c71-a7d2-242d55e59f81

ntsekouras commented 6 days ago

I tried this in .com and actually reproduced. Could it be happening only there?

xavier-lc commented 6 days ago

This bug was introduced to dotcom with this PR: https://github.com/WordPress/gutenberg/pull/65945

annezazu commented 6 days ago

Thank you all for diving in! I see a PR is underway to address this.

annezazu commented 5 days ago

I'm going to reopen this since the original problem remains in this issue. Namely that you cannot view or edit template parts when Write mode is enabled:

https://github.com/user-attachments/assets/c5c51253-9674-4738-a499-7deb9474d1ac

To be clear, I'd expect to be able to both see the template parts in List View and then be able to edit the content of individual blocks. Part of the issue is that we need to ensure blocks like Site Title are compatible with contentOnly and that we have a way to edit/manage a menu with contentOnly. With that said though, for now, we should be able to see the template parts in List View and have a contentOnly experience, even if there is a lock icon and you cannot select anything.

richtabor commented 5 days ago

I tried this in .com and actually reproduced. Could it be happening only there?

Na, occurs universally.

xavier-lc commented 2 days ago

I'm going to reopen this since the original problem remains in this issue. Namely that you cannot view or edit template parts when Write mode is enabled

I've traced the origin of this behavior back to https://github.com/WordPress/gutenberg/pull/65204. On the previous commit (PR https://github.com/WordPress/gutenberg/pull/65373) it's possible to view and edit template parts, even though at that point the Write mode was called Edit.

cc @annezazu @youknowriad