You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ability to customise Navigation block "mobile" overlay #39142
Currently any styles you apply to the Navigation block will also apply when it is in "mobile" mode. This is sometimes not desirable as the "mobile" menu may require different visual properties.
Furthermore, it may also be desirable to add additional content (other than simply the Navigation block) to the overlay.
Example of styling inconsistencies
For example, if you align the navigation items to the right then the items in the mobile menu are also right aligned.
Screen.Capture.on.2022-03-01.at.16-35-20.mov
What is your proposed solution?
The solution may be to allow the overlay to be defined as a template part. A user could create the appropriate template part (e.g. navigation-overlay.html) and then the block would allow the user to "assign" the template part to the block to be used as the overlay.
As template parts are containers this would provide freedom to style the overlay as required as well as to add any content required.
We could explore adding dedicated UI controls which only apply to the navigation when it is in mobile mode. That said, it might get complex if styles are not mutually exclusive so the mobile styles would have to take precedence.
Alternatively we could wait for a more robust responsive styling solution to land in Gutenberg which might allow blocks to define a standard means to style elements different based on viewport.
It's good to have a dedicated issue for this one, thank you, I definitely agree.
I touched a bit on the following concept in this comment as well, but the way I see it, the contents of your mobile overlay is a blank canvas, and you should be able to put any block there, including columns and non navigation blocks.
One idea here is to leverage the same concept of saving inner blocks to a custom post type, as the navigation block does for its menu items. That is, have an entirely separate CPT for the contents of the modal. Here's an early mockup:
One subgoal to accomplish here would be to ensure that the X to close the modal could sit exactly where the = menu item sits, so it feels like the same button. A root level padding solution (#35607) that is inherited by the modal (but user overridable) would be a good start for that.
Another idea that might help is, if the navigation block is used inside a Header template part, the entire template part is kept (duplicated) inside the modal overlay, with logo and open/close button. This would also let the burger icon transform into a close icon, which could be a nice touch.
Reacted by Dave Smith, Channing, kiran, Phil Sola and alizeh
Thanks for your excellent insight as always @jasmussen.
...the contents of your mobile overlay is a blank canvas, and you should be able to put any block there, including columns and non navigation blocks.
I think the idea of a wrapper into which you can place multiple Navigation blocks is a good idea. After all if the menus are drastically different them they shouldn't be the same <nav> anyway.
From a technical POV that's a challenge because it's going to require a separate "mobile overlay" block which has the ability to be populated differently in the editor canvas depending on the value of an inspector control toggle.
As a user I need to be able to switch between populating the "desktop" and "mobile" variations of the block. I have a video which explains how you can use x2 separate Navigation blocks and use CSS to show and hide them. It would be similar to this concept, except we'd need a design/UX solution for how users would interact with the block within the editor - that's the big challenge. How would you see that working?
It would be similar to this concept, except we'd need a design/UX solution for how users would interact with the block within the editor - that's the big challenge. How would you see that working?
Yes, that's definitely similar.
My instinct is always to start with as little as possible, the shortcomings always have a way of presenting themselves when you do that, so you can address them one by one.
In this case, I would lean towards the mockup above: if you toggle the mobile menu to "always" and click the burger icon in the canvas, the very act of clicking that item would open up the modal with a new blank canvas, with any saving or creation of a dedicated overlay slot happening transparently in the background.
Some questions immediately present themselves:
Should we copy the navigation block you built before toggling "Always" into the overlay? Perhaps yes.
Should you be able to have a dedicated overlay also when the "Mobile" option is toggled? Maybe, but could also wait?
Is it enough to click the burger icon in the canvas to load the contents of the overlay in template isolation mode? Or should there also be a dedicated button in the inspector, "Edit overlay"?
Do I need to be able to swap out the contents of one overlay with another if one such exists, just like the nav block itself? Sure maybe.
All of those feel solvable, even if it is legitimately a big and challenging project. From an UX perspective, the biggest challenge I see with the approach is how this is compatible with editing the contents of the navigation block in isolation (i.e. #37950) since the UI may end up being very similar. My hope is that in practice it'll be fine: when it's collapsed to a burger button, it loads the overlay, when it's not, it loads the innerblocks of the parent nav instead.
We'd like to be able to style the overlay differently to the regular block, using theme.json. Unless we create a lot of extra properties in theme.json for the Navigation block, we're going to find it difficult to support all these different properties. However what if we made the overlay its own block? Then we can simply use the standard theme.json properties on that block...
This definitely needs reviving - the mobile menu is horrible out of the box and for a non-developer who may not know how to write CSS to style it any differently, that could be pretty offputting. I love the initial mockup and thought process from @jasmussen regarding a blank canvas to build out the overlay using blocks including columns, buttons, navigations.
Some really fantastic mobile overlay designs could be created directly in the block editor for everyone without needing to be a skilled developer to hack away at the current implementation.
changed the title [-]Style Navigation block differently for "mobile menu"[/-][+]Ability to customise Navigation block "mobile" overlay [/+]on Nov 19, 2024
In light of developments in #43852 I've rewritten the title and description of this Issue to better reflect the objective and to provide a canonical Issue for folks to refer to.
Hey folks, there has been some discussion about looking at Ollie's Menu Designer as a possible solution for this. The repo is open and right now the plugin is available on WP.org.
I'm totally open for this to be considered for core (or whatever parts make sense), but right now I don't have the bandwidth to shepherd it through myself. I'm happy to advise and help guide it along though. Just let me know what you need from me.
Reacted by Tammie Lister, annezazu, Thomas Navarro, Andron Ocean, Luke Cavanagh, Juanfra Aldasoro and Rohan
Reacted by Riad Benguella, annezazu, Tammie Lister, Mike Hemberger, Ajit Bohra, Juanfra Aldasoro, Rohan and Mateus Machado Luna
Reacted by annezazu, Mike Hemberger, Juanfra Aldasoro and Rohan
Hey @mikemcalister! Thanks so much for both confirming this publicly here and for being game for this in general. It's really awesome to see when this has been a long standing point of feedback. Let's get some devs to review what you have in place, determine what might conflict and what might be compatible, and go from there. I imagine we'll need design help as this gets underway further in the future so a light flag for @jasmussen (nothing is needed right now).
I'm not sure if this is the best place for this, but we should get some kind of clarity on what we're hoping to implement from Menu Designer. It does mobile and mega menus. This discussion is around the mobile menu part.
The mega menus are quite a bit more complex because of the settings and adjustments needed to make them display accessibly and predictably across all themes. It's more complex than it might seem.
So it would be helpful to understand what we're aiming for.
Something that would be super helpful for user/dev experience is to keep the Menu template part slug/name so users could easily transition to the core solution once implemented. Between Nick Diego's prototype and Menu Designer, that would be potentially thousands of users that could seamlessly transition.
Hi @mikemcalister. Thanks for your input here (and for the Plugin!).
We're just wrapping up a few things for the 6.9 cycle right now but myself and @scruffian are intending to propose a route forward here so that we can gain alignment.
Please do deep an eye on the Issue. We'd value your feedback.
Something that would be super helpful for user/dev experience is to keep the Menu template part slug/name so users could easily transition to the core solution once implemented. Between Nick Diego's prototype and Menu Designer, that would be potentially thousands of users that could seamlessly transition.
I think that your plugin uses the a slug of mobile for overlay template parts. I think this name is a bit misleading, since it is possible to set the overlay to always appear - not just on mobile. For that reason I think it's more likely that we'll go with a more generic name like overlay. I know this means that template parts will not work, but I don't think we can justify using a name that doesn't quite fit. I'm open to other opinions though :)
@mikemcalister thanks for all the work on the Ollie Menu Designer. It's great how well it reuses parts of core that are already there - leaning into template parts and patterns. This has really helped validate that the approach we were exploring in #55657 is the right one, and that this is a feature that users really want.
There were some great additions in the plugin too - the Preview button is super helpful, and all of the patterns that come with the theme really help support the overlay, so it all works really nicely together.
The plugin has also helped us to realise that we are still missing an important feature in core to support this - template part persistence. At the moment when switching themes you lose access to your template parts from previous themes. We need to address this as part of this work, so that overlays can persist across theme switches.
I'm also curious to hear your experience of building this plugin - was there anything you had to work around or which you think could be improved in core to make this easier?
The plugin has also helped us to realise that we are still missing an important feature in core to support this - template part persistence. At the moment when switching themes you lose access to your template parts from previous themes. We need to address this as part of this work, so that overlays can persist across theme switches.
I think that your plugin uses the a slug of mobile for overlay template parts.
Hey @scruffian, the template part area I'm referring to uses simply menu to register the area, it's not specific to mobile.
function omd_template_part_areas( array $areas ) {
$areas[] = array(
'area' => 'menu',
'area_tag' => 'div',
'description' => __( 'Menu templates are used to create dropdown menus and mobile menus.', 'ollie-menu-designer' ),
'icon' => 'layout',
'label' => __( 'Menu', 'ollie-menu-designer' ),
);
return $areas;
}
was there anything you had to work around or which you think could be improved in core to make this easier?
We let users create a new template part (and edit one) inline with some links below the selector. This helps bridge the gap between the template part screen and the editor screen. However, we have to open this in a new tab and it kind of breaks the flow. Ideally, this could be handled with the navigator just like we do when we edit template parts from within the editor, so users can easily navigate into an edit screen and then back out.
We also let them customize the mobile menu toggle background and color. That wasn't particularly tricky, per se, but could be done much cleaner with a core implementation.
That's all I can think of off the top of my head for workarounds. Ultimately, the mobile part of this isn't very complicated because it's largely using technology we already have. The mega menu part on the other hand... 😅
Activity
jasmussen commentedon Mar 2, 2022
It's good to have a dedicated issue for this one, thank you, I definitely agree.
I touched a bit on the following concept in this comment as well, but the way I see it, the contents of your mobile overlay is a blank canvas, and you should be able to put any block there, including columns and non navigation blocks.
One idea here is to leverage the same concept of saving inner blocks to a custom post type, as the navigation block does for its menu items. That is, have an entirely separate CPT for the contents of the modal. Here's an early mockup:
One subgoal to accomplish here would be to ensure that the X to close the modal could sit exactly where the = menu item sits, so it feels like the same button. A root level padding solution (#35607) that is inherited by the modal (but user overridable) would be a good start for that.
Another idea that might help is, if the navigation block is used inside a Header template part, the entire template part is kept (duplicated) inside the modal overlay, with logo and open/close button. This would also let the burger icon transform into a close icon, which could be a nice touch.
getdave commentedon Mar 2, 2022
Thanks for your excellent insight as always @jasmussen.
I think the idea of a wrapper into which you can place multiple Navigation blocks is a good idea. After all if the menus are drastically different them they shouldn't be the same
<nav>anyway.From a technical POV that's a challenge because it's going to require a separate "mobile overlay" block which has the ability to be populated differently in the editor canvas depending on the value of an inspector control toggle.
As a user I need to be able to switch between populating the "desktop" and "mobile" variations of the block. I have a video which explains how you can use x2 separate Navigation blocks and use CSS to show and hide them. It would be similar to this concept, except we'd need a design/UX solution for how users would interact with the block within the editor - that's the big challenge. How would you see that working?
jasmussen commentedon Mar 2, 2022
Yes, that's definitely similar.
My instinct is always to start with as little as possible, the shortcomings always have a way of presenting themselves when you do that, so you can address them one by one.
In this case, I would lean towards the mockup above: if you toggle the mobile menu to "always" and click the burger icon in the canvas, the very act of clicking that item would open up the modal with a new blank canvas, with any saving or creation of a dedicated overlay slot happening transparently in the background.
Some questions immediately present themselves:
All of those feel solvable, even if it is legitimately a big and challenging project. From an UX perspective, the biggest challenge I see with the approach is how this is compatible with editing the contents of the navigation block in isolation (i.e. #37950) since the UI may end up being very similar. My hope is that in practice it'll be fine: when it's collapsed to a burger button, it loads the overlay, when it's not, it loads the innerblocks of the parent nav instead.
scruffian commentedon Mar 10, 2022
We'd like to be able to style the overlay differently to the regular block, using theme.json. Unless we create a lot of extra properties in theme.json for the Navigation block, we're going to find it difficult to support all these different properties. However what if we made the overlay its own block? Then we can simply use the standard theme.json properties on that block...
jasmussen commentedon Mar 11, 2022
You suggested here that the overlay could be a block. Here we are discussing something adjacent, total customization of the contents of an overlay. In both cases we'd need theme.json integration — are the two tasks complementary?
scruffian commentedon Mar 11, 2022
Yeah I think they are basically the same thing!
getdave commentedon Mar 15, 2022
I've been thinking about this as well and come to the same idea.
We could have some kind of wrapping block that allows you to toggle when the overlay is displayed (like the Nav block does today).
Then you could nest Nav blocks within that block. It could provide context to customise the behaviour.
luisherranz commentedon May 3, 2022
I think this could be elegantly solved without any ad-hoc implementation if:
We add the ability to configure different layers/states using blocks.
We allow any block to become a section capable of overwriting the global styles of their children.
phil-sola commentedon Mar 31, 2023
This definitely needs reviving - the mobile menu is horrible out of the box and for a non-developer who may not know how to write CSS to style it any differently, that could be pretty offputting. I love the initial mockup and thought process from @jasmussen regarding a blank canvas to build out the overlay using blocks including columns, buttons, navigations.
Some really fantastic mobile overlay designs could be created directly in the block editor for everyone without needing to be a skilled developer to hack away at the current implementation.
getdave commentedon Mar 31, 2023
@phil-sola I've previously recommended this as one of the features contributors should look to focus on.
[-]Style Navigation block differently for "mobile menu"[/-][+]Ability to customise Navigation block "mobile" overlay [/+]getdave commentedon Nov 19, 2024
In light of developments in #43852 I've rewritten the title and description of this Issue to better reflect the objective and to provide a canonical Issue for folks to refer to.
1 remaining item
mikemcalister commentedon Oct 9, 2025
Hey folks, there has been some discussion about looking at Ollie's Menu Designer as a possible solution for this. The repo is open and right now the plugin is available on WP.org.
I'm totally open for this to be considered for core (or whatever parts make sense), but right now I don't have the bandwidth to shepherd it through myself. I'm happy to advise and help guide it along though. Just let me know what you need from me.
annezazu commentedon Oct 9, 2025
Hey @mikemcalister! Thanks so much for both confirming this publicly here and for being game for this in general. It's really awesome to see when this has been a long standing point of feedback. Let's get some devs to review what you have in place, determine what might conflict and what might be compatible, and go from there. I imagine we'll need design help as this gets underway further in the future so a light flag for @jasmussen (nothing is needed right now).
jasmussen commentedon Oct 10, 2025
Thanks for the light flag on the exciting potential. I'm here to help if/when things connect.
karmatosed commentedon Oct 10, 2025
I am super excited to see this @mikemcalister and even more so to see momentum after you posted. Can’t wait to see something brew up.
mikemcalister commentedon Oct 12, 2025
I'm not sure if this is the best place for this, but we should get some kind of clarity on what we're hoping to implement from Menu Designer. It does mobile and mega menus. This discussion is around the mobile menu part.
The mega menus are quite a bit more complex because of the settings and adjustments needed to make them display accessibly and predictably across all themes. It's more complex than it might seem.
So it would be helpful to understand what we're aiming for.
mikemcalister commentedon Oct 16, 2025
Something that would be super helpful for user/dev experience is to keep the Menu template part slug/name so users could easily transition to the core solution once implemented. Between Nick Diego's prototype and Menu Designer, that would be potentially thousands of users that could seamlessly transition.
getdave commentedon Oct 17, 2025
Hi @mikemcalister. Thanks for your input here (and for the Plugin!).
We're just wrapping up a few things for the 6.9 cycle right now but myself and @scruffian are intending to propose a route forward here so that we can gain alignment.
Please do deep an eye on the Issue. We'd value your feedback.
scruffian commentedon Oct 17, 2025
I think that your plugin uses the a slug of
mobilefor overlay template parts. I think this name is a bit misleading, since it is possible to set the overlay to always appear - not just on mobile. For that reason I think it's more likely that we'll go with a more generic name likeoverlay. I know this means that template parts will not work, but I don't think we can justify using a name that doesn't quite fit. I'm open to other opinions though :)scruffian commentedon Oct 17, 2025
@mikemcalister thanks for all the work on the Ollie Menu Designer. It's great how well it reuses parts of core that are already there - leaning into template parts and patterns. This has really helped validate that the approach we were exploring in #55657 is the right one, and that this is a feature that users really want.
There were some great additions in the plugin too - the Preview button is super helpful, and all of the patterns that come with the theme really help support the overlay, so it all works really nicely together.
The plugin has also helped us to realise that we are still missing an important feature in core to support this - template part persistence. At the moment when switching themes you lose access to your template parts from previous themes. We need to address this as part of this work, so that overlays can persist across theme switches.
I'm also curious to hear your experience of building this plugin - was there anything you had to work around or which you think could be improved in core to make this easier?
Thanks again for all you work :)
annezazu commentedon Oct 17, 2025
Ensuring this is tracked here: #72452
mikemcalister commentedon Oct 20, 2025
Hey @scruffian, the template part area I'm referring to uses simply
menuto register the area, it's not specific to mobile.We let users create a new template part (and edit one) inline with some links below the selector. This helps bridge the gap between the template part screen and the editor screen. However, we have to open this in a new tab and it kind of breaks the flow. Ideally, this could be handled with the navigator just like we do when we edit template parts from within the editor, so users can easily navigate into an edit screen and then back out.
We also let them customize the mobile menu toggle background and color. That wasn't particularly tricky, per se, but could be done much cleaner with a core implementation.
That's all I can think of off the top of my head for workarounds. Ultimately, the mobile part of this isn't very complicated because it's largely using technology we already have. The mega menu part on the other hand... 😅
scruffian commentedon Oct 20, 2025
Ah yes, that may be more reusable. We usually go with "navigation" rather than "menu" because of the potential confusion with restaurants...
getdave commentedon Jul 20, 2026
I consider this completed as of WordPress 7.0.