-
Notifications
You must be signed in to change notification settings - Fork 35
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
Patterns using a Navigation block have ref
set
#545
Comments
What's the solution here - strip the |
I think so, the messy part will be making sure that doesn't break anything. Other blocks have |
I'm not sure how to approach this, but sharing some thoughts.. In Pattern Directory we can insert a Navigation block in the UI(as user), but with no permissions it feels broken.. Should we remove the block from the inserter there? 🤔 Would removing the @getdave do you have any thoughts about this, since you've worked a ton in Navigation block? |
If the nav block is hidden from the inserter, then no one can use it (including the wporg user) and it can't appear in the core/bundled patterns (because we would also need to validate patterns to remove it, since some pattern authors build elsewhere and paste in content). When the directory launched, a bunch of site editing blocks were disabled including Navigation, and it was considered a blocker for GB bundled patterns - see #489, p9ue0y-Sc.
That would solve the immediate blocker for GB, yeah - how would you remove it (in a way that wouldn't come back if the pattern needs to be edited)? |
Since 6.1, the Nav block should not require a
Therefore I'd suggest testing that removing the ref provides a suitable experience. Note also that ref is currently an ID reference. In the future we expect to migrate that to a slug, from which we will look up the most suitable menu (if you have one). I hope that helps? Feel free to loop me in and I'll help as I can. |
@getdave I think the issue is that the editor always adds the
An option is to find and remove the Other alternatives are adding a I think the preview of navigation blocks in the pattern inserter in Gutenberg should have some defaults or be configurable in some way to help promote patterns before they are inserted in the editor view. What do you think? |
@miksansegundo Have you tried recently? I was just able to publish a pattern with a navigation block, without Here's the pattern markup, copied from .org:
|
@richtabor I tried in Gutenberg v14.9.1 and v15.0.0-rc.1 in WordPress 6.1.1. In my project, I create patterns as posts on a WordPress site using Gutenberg. I'll open an issue there. When my patterns with navigation are applied to a page, I get the same error as in this issue because of the I just tried in the Pattern Directory and got an error because I don't have permission to add navigation blocks. Adding.a.pattern.with.navigation.in.the.PD.mov |
Same here. I created that one on the latest pattern directory directly.
Same, though it does still show up in the pattern itself. Not ideal. |
@richtabor I'm guessing that you were able to create that pattern in the PD without |
This use case suggests there's value in allowing users to toggle off the auto creation of the Nav Menu posts which back the data for the Nav block (that;s what the I can see how the current situation is not ideal. |
I think patterns should never contain a |
@draganescu I believe we don't currently have placeholder content in the block. So my understanding of what you're saying is that we need to add a placeholder content so in the future patterns can display without However in the editor canvas how would the block know when to use the fallbacks mechanic vs use placeholders? |
@getdave yes, we should add that, if the example attribute is not enough, because there has to be a way for a pattern to preview a "default" state in the directory but fallback to user's data when inserterd. Controlled inner blocks should only be used if the pattern is overly specific (e.g. needs exactly 4 links).
We should maybe expand the |
For example, Centered header with logo — the pattern code has a navigation block with a ref set, and when that's used on a different site, the referenced menu does not exist, causing an error:
Example pattern code:
The
ref
should not be there.The text was updated successfully, but these errors were encountered: