-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
What problem does this address?
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.