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

Find "most suitable" Navigation Menu fallback based on Nav block insertion location context #56247

Open
getdave opened this issue Nov 17, 2023 · 0 comments
Labels
[Block] Navigation Affects the Navigation Block [Feature] Navigation Menus Any issue relating to Navigation Menus [Type] Enhancement A suggestion for improvement.

Comments

@getdave
Copy link
Contributor

getdave commented Nov 17, 2023

Currently the Navigation block utilises a fallback mechanic to pick a "most suitable" Navigation for the user to avoid having an empty Navigaiton block when a site is first created or a Theme switch occurs.

The algorithm is currently (in order of priority):

  • Most recently created (block menu)
  • Most recently created (classic menu)
  • List of your Pages
  • Empty

However there is a flaw with this.

  • Add a Nav block to the Header of your site.
  • It is automatically named "Header Navigation". It is the only Navigation Menu on your site.
  • Add a Nav block to the Foorter of your site.
  • It is automatically assigned the "most recent" Navigation Menu (via the fallback system). This results in "Header Navigaiton" showing in this block even though it's in the Header.

A preferable scenario would be that the system is aware of the context of where you are inserting the Navigation block and chooses the "most suitable" Navigation based on this context.

In such a system we would prepend another step to the fallback mechanic which would try to find a Navigation Menu based on the slug of the template part of the Navigation block which is requesting the fallback. If that fails to find anything matching then it immediately provides a list of Pages as the fallback.

This work may require #45512 to be completed prior to implementation as it would be better to search for "suitable" Navigation Menus by something that the user cannot modify (e.g. slug of the Navigation Menu) rather than something that could be modified (e.g. title of the Navigation Menu).

@getdave getdave added [Type] Enhancement A suggestion for improvement. [Block] Navigation Affects the Navigation Block [Feature] Navigation Menus Any issue relating to Navigation Menus labels Nov 17, 2023
@getdave getdave changed the title Improve Navigation block "most suitable" fallback Navigation block "most suitable" fallback based on block insertion location context Nov 17, 2023
@getdave getdave changed the title Navigation block "most suitable" fallback based on block insertion location context Find "most suitable" Navigation Menu fallback based on Nav block insertion location context Nov 17, 2023
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] Navigation Menus Any issue relating to Navigation Menus [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

1 participant