Skip to content

Pattern panel is blank when clicking on template part canvas in 6.7 beta 1 #65833

Closed

Description

@mikemcalister

Description

After you insert a pattern into the page from the slide out panel, if you click a template part in the block editor canvas, the pattern panel clears the patterns but remains open in a blank state.

Pre 6.7 beta, the panel closed entirely if you clicked into the editor canvas. I'm not sure what is the expected behavior here. Are we keeping the panel open now until closed manually? At the very least, we shouldn't see an empty panel here.

Step-by-step reproduction instructions

  1. Make sure you are on the 6.7 beta 1
  2. Go to the site editor
  3. Add a pattern to the page
  4. While the pattern sidebar is still open, click into the editor canvas and note if the panel remains open
  5. Click onto a template part and note if the panel goes blank

Screenshots, screen recording, code snippet

Image

Here's the issue demonstrated in a video.

CleanShot.2024-10-02.at.10.10.10.mp4

Environment info

  • WordPress 6.7 beta 1
  • Chrome
  • MacOS

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

Activity

  1. colorful-tones commented on Oct 2, 2024

    @colorful-tones
    Member

    @mikemcalister do you mind providing a little more detail on the context from which you're starting from. The video does not capture it. I know you're in the Site Editor and you're adding a pattern, but are you editing a template, and which template please?

  2. colorful-tones commented on Oct 2, 2024

    @colorful-tones
    Member

    An interesting use case here. In order to recreate this in WP stable I had to create a new blank template and insert Template Part: header, blank Paragraph block, and Template Part: footer. Then, in the empty middle Paragraph block, open the pattern inserter, insert a pattern, and then click on the Template Part: footer to see how the pattern inserter closes.

    Playground: TT4 - WP 6.6.2 Playground: TT5 - WP nightly with Gutenberg
    template-part-pattern-tt4-stable.mp4
    template-part-pattern-tt5-nightly.mp4

    Worth noting that the TT5 theme with WP nightly + Gutenberg has a difference experience than the bug reported. So, it might help to clarify what the intended interaction and experience should be.

  3. moved this to 🗣️ In Discussion / Needs Decision in WordPress 6.7 Editor Taskson Oct 2, 2024
  4. colorful-tones commented on Oct 2, 2024

    @colorful-tones
    Member

    I suspect that this may be a regression or odd intersecting use case that may have been impacted by the Zoom Out work for 6.7. I'm adding it to the 6.7 project board, but feel free to remove it. @noisysocks might have some guidance here.

  5. mikemcalister commented on Oct 3, 2024

    @mikemcalister
    Author

    @colorful-tones Hey Damon, thanks for triaging this. I was not in a template, I was adding a pattern to a standard page in the site editor. I was able to replicate this in Twenty Twenty Five as well as my own theme. Here's another video with Twenty Twenty Five:

    CleanShot.2024-10-02.at.21.46.55.mp4
  6. moved this from 🗣️ In Discussion / Needs Decision to 📥 Todo in WordPress 6.7 Editor Taskson Oct 4, 2024
  7. getdave commented on Oct 7, 2024

    @getdave
    Contributor

    @mikemcalister Thanks for persisting with reporting this. It's really helpful to narrow down the exact steps.

    What I can see from your video is that your clicks end up selecting either:

    • a block in the canvas
    • a template part (in this case the Header)

    Specifically

    1. You click and the Image is selected ("Featured Image")
    2. You click again and the Header template part is selected
    3. You click again and the Heading Block is selected

    In all of those circumstances it is not possible to insert a pattern and thus the inserter is correctly empty.

    Notice however, that when you select the Group block (the yellow pattern) you do get choices in the Patterns inserter.

    Do you agree with the above assessment?

    That said, I can see how it could be confusing that if you're trying to select "the empty canvas" you cannot seem to do this without selecting a block.

    I believe this may also be impacted by the bug trying to be fixed in #65857.

    This becomes easier with #65785. Once that is in a 6.7 Beta/RC it will be easier to click "outside" of the canvas.

    Let me know if I can help further.

  8. moved this from 📥 Todo to 🗣️ In Discussion / Needs Decision in WordPress 6.7 Editor Taskson Oct 7, 2024
  9. mikemcalister commented on Oct 7, 2024

    @mikemcalister
    Author

    @getdave Hey Dave, thanks for following up.

    Yes, your assessment is fairly accurate. When clicking in a block, the panel stays open and populated.

    Similarly, as you can see in this new video, I'm clicking in the white margin to the left of the page content and I'm getting that same empty panel. As a pro user, I know that this belongs to the template, so that's why I'm getting that empty panel. But many average users are going to click that same white space since it feels like it should be a group area (which technically it is). Clicking away into a canvas is also a common pattern for exiting panels and modals, even in WP.

    Further, you can see when I click near the featured image, it glitches a few times. That may be separate from the initial issue mentioned here.

    CleanShot.2024-10-07.at.16.30.08.mp4
  10. ndiego commented on Oct 9, 2024

    @ndiego
    Member
    pattern-selection-6-7-bug.mp4

    I tested this further and believe it's quite a significant UX issue.

  11. moved this from 🗣️ In Discussion / Needs Decision to 📥 Todo in WordPress 6.7 Editor Taskson Oct 9, 2024
  12. added
    [Priority] HighUsed to indicate top priority items that need quick attention
    and removed on Oct 9, 2024
  13. colorful-tones commented on Oct 10, 2024

    @colorful-tones
    Member

    Thanks for removing the Zoom Out label @ndiego 👍

    I do think that there is likely overlap and side-effects being caused by the Zoom Out work for 6.7, which are likely impacting the canvas root. I do not have a PR/Issue to link to though.

    FWIW - here is an additional video of clicking around with pattern inserter and Zoom Out stuff activated too, which might help debug or open up the conversation around how the canvas and context of the overall editing experience gets confusing. I'm honestly not sure what to expect at this point when I click on certain things? 😕

    pattern-canvas-click-oddity.mp4
  14. getdave commented on Oct 11, 2024

    @getdave
    Contributor

    Ok I'm pretty sure I've figured this one out.

    If we dive deep into the code that determines what Patterns show up we end up here:

    _destinationRootClientId = getBlockRootClientId(
    selectedBlockClientId
    );

    This _destinationRootClientId ultimately ends up being passed as rootClientId to <PatternCategoryPreviews> here:

    <PatternCategoryPreviews
    rootClientId={ destinationRootClientId }

    This is then used to get the patterns that are available by passing it here:

    const [ allPatterns, , onClickPattern ] = usePatternsState(
    onInsert,
    rootClientId,
    category?.name
    );

    The problem is that in Zoom Out mode, the "root" should be the sectionRootClientId which is acting as the top level block. However, when we click in the "empty" space (and select the core/post-content block which is acting as the section root) the code is actually finding the blockRootClientId of the core/post-content block. This is some random Group block which is why no patterns show up.

    So the solution is to check if the selectedBlockClientId matches the sectionRootClientId and then ensure it is that which is passed to the Patterns retrieval mechanics.

    This is easier to show rather than explain so I'll spin up a PR for review. I thought I'd document it here so I can pick up against next week as it's nearly my end of day.

  15. getdave commented on Oct 11, 2024

    @getdave
    Contributor

    Noting that this bug does not manifest on Gutenberg trunk but only on wp/6.7 branch. This means there may be a PR that has not been picked to that branch.

  16. talldan commented on Oct 17, 2024

    @talldan
    Contributor

    Trunk has this PR, which 6.7 doesn't have - #65611 - so it will work quite differently.

    Despite that, I tested latest 6.7, and this issue seems mostly resolved from what I can tell. At least I found it difficult to reproduce the issue with the empty inserter, there's a chance I didn't take the right steps. It'd be great to get some further testing on this before closing the issue.

  17. getdave commented on Oct 17, 2024

    @getdave
    Contributor

    I believe the rapid/repeating reloading of Patterns was just fixed in #66162.

    However, the issue of seeing "No results" still remains. To replicate:

    • Checkout wp/6.7 branch
    • Site Editor
    • Pages
    • Choose Sample Page
    • Open Patterns inserter
    • Make sure you're in Zoom Out.
    • Click on some blocks. Now click on some empty space within the block canvas (not the grey area around the canvas).
    • Notice the Paterns inserter is now "empty results".

    As shown in the video below that's because we're selecting the core/post-content block.

    Screen.Capture.on.2024-10-17.at.15-56-10.mp4

    I tried to explain why I think that is in this comment.

    I think we need to pass the sectionRootClientId (in this case the core/post-content) block to the mechanism that retrieves patterns.

  18. ndiego commented on Oct 17, 2024

    @ndiego
    Member

    Notice the Paterns inserter is now "empty results".

    Yeah, if we can just get this empty section to close, we should be good.

  19. getdave commented on Oct 17, 2024

    @getdave
    Contributor

    Draft of a fix in #66214. Might be a bit naive. Will try to evolve again tomorrow if no one else picks it up first.

  20. getdave commented on Oct 21, 2024

    @getdave
    Contributor

    Two PRs merged to the wp/6.7 branch as a patch fix for 6.7. This is to prioritise stability for 6.7.

    A more robust fix is already in trunk in #65611 but backporting that would require backporting other PRs and those are complex and have potential for introducing other bugs.

    Going to close out.

  21. moved this from 🏗️ In Progress to ✅ Done in WordPress 6.7 Editor Taskson Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Package] Patterns/packages/patterns[Priority] HighUsed to indicate top priority items that need quick attention[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions