-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
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).