Skip to content

Ability to customise Navigation block "mobile" overlay  #39142

@getdave

Description

@getdave

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.

Related

#43852

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    CSS StylingRelated to editor and front end styles, CSS-specific issues.[Block] NavigationAffects the Navigation Block[Type] EnhancementA suggestion for improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions