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

Allow selecting the default core/navigation-link variant in the core/navigation block #50982

Closed
sethrubenstein opened this issue May 25, 2023 · 6 comments
Labels
[Block] Navigation Affects the Navigation Block [Feature] Extensibility The ability to extend blocks or the editing experience [Type] Enhancement A suggestion for improvement.

Comments

@sethrubenstein
Copy link
Contributor

sethrubenstein commented May 25, 2023

What problem does this address?

The core/navigation experience is heavily geared towards core taxonomies such as category and tag as well as the page 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 to DEFAULT_BLOCK at

__experimentalDefaultBlock: DEFAULT_BLOCK,
. Then it would be as simple as passing something like {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.

@talldan talldan added [Feature] Extensibility The ability to extend blocks or the editing experience [Block] Navigation Affects the Navigation Block labels May 26, 2023
@bph bph moved this to ❓ Triage in WordPress 6.3.x Editor Tasks May 26, 2023
@sethrubenstein
Copy link
Contributor Author

Once I get some Gutenberg build and test issues resolved locally I'll make a pull request for this pewresearch@a3b3970

@annezazu
Copy link
Contributor

annezazu commented Jun 5, 2023

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

@sethrubenstein
Copy link
Contributor Author

After some merging nightmare I have an updated pull request for this now that #52083 has been merged. #52610

@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Jul 19, 2023
@bph bph moved this to ❓ Triage in WordPress 6.4 Editor Tasks Jul 25, 2023
@bph bph moved this from Triage to Needs Decision / Discussion in WordPress 6.4 Editor Tasks Sep 8, 2023
@bph bph moved this from Needs Decision / Discussion to Punted to 6.5 in WordPress 6.4 Editor Tasks Sep 23, 2023
@bph bph moved this to In Progress in Increase Gutenberg Extensibility Nov 23, 2023
@bph bph moved this to ❓ Triage in WordPress 6.5 Editor Tasks Nov 23, 2023
@annezazu
Copy link
Contributor

annezazu commented Feb 8, 2024

After a review by core editor triage leads and core editor tech leads, this has been removed from the board for 6.5 consideration.

@annezazu
Copy link
Contributor

annezazu commented Feb 8, 2024

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!

@sethrubenstein
Copy link
Contributor Author

That it does @annezazu . #58262 is a hugely welcome addition. Thanks!

@github-project-automation github-project-automation bot moved this from Punted to 6.5 to Done in WordPress 6.4 Editor Tasks Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Feature] Extensibility The ability to extend blocks or the editing experience [Type] Enhancement A suggestion for improvement.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants