-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Allow selecting the default core/navigation-link
variant in the core/navigation
block
#50982
Comments
Once I get some Gutenberg build and test issues resolved locally I'll make a pull request for this pewresearch@a3b3970 |
Thanks for jumping in here to both share an issue and spin up a PR! Love to see Pew Research continuing to drive forward. Going to tag in some folks doing work around 6.3 related priorities for navigation which you can see here: #50165 @getdave @scruffian |
After a review by core editor triage leads and core editor tech leads, this has been removed from the board for 6.5 consideration. |
Of note, you might want to dig into this recently merged PR: add allowedBlocks field to block.json to specify allowed children (58262) along with work done to ensure all custom taxonomies/post types are available for the Navigation block #54801 & #56100 I think these might solve the problem for you but curious if not! |
What problem does this address?
The
core/navigation
experience is heavily geared towards core taxonomies such as category
andtag
as well as thepage
post type. The navigation-link block provides variations from all public taxonomies, but because of issues with the current insertion UI it effectively hides them. It's easier to create custom navigation blocks if your site structure is centered around a custom taxonomy or other model altogether.What is your proposed solution?
I think a simple "Gutenberg API forward solution" would be to add an attribute something like
defaultVariant
to the core navigation block and then check for that attribute value before defaulting toDEFAULT_BLOCK
atgutenberg/packages/block-library/src/navigation/edit/inner-blocks.js
Line 101 in b95148f
{name: 'core/navigation-link', attributes: {type:'my-custom-taxonomy', kind:'taxonomy'}}
as the default value using existing JS or PHP hooks.I believe there have been several discussions about setting allowed blocks as an attribute on most core blocks, like in the group block (#49128). At Pew Research Center, we have adopted this strategy in our block library, and it has been very effective. It allows us to extend our own blocks internally using block variations. I think applying the same logic to
__experimentalDefaultBlock
could give developers a lot of flexibility within core blocks and enable them to customize the experience for their end users.The text was updated successfully, but these errors were encountered: