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

Ability to have different links in the "mobile" menu vs the standard menu. #38201

Open
jamiemarsland opened this issue Jan 25, 2022 · 13 comments
Labels
[Block] Navigation Affects the Navigation Block Mobile Web Viewport sizes for mobile and tablet devices Needs Design Feedback Needs general design feedback. [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Type] Enhancement A suggestion for improvement.

Comments

@jamiemarsland
Copy link

jamiemarsland commented Jan 25, 2022

Have different Mobile Menu page links vs the main navigation (At the moment the navigation blocks uses the same menu data for all screen sizes)

What problem does this address?

In some circumstances it is useful to have different items in the navigation on "mobile" vs "desktop" screen sizes. Currently this is not possible using the Navigation block

What is your proposed solution?

A means to select different menus to be displayed at different break points.

@annezazu
Copy link
Contributor

@jamiemarsland it sounds like you want a way to conditionally show nav items based on screen size. Is that right? Just want to ensure the description is filled out.

@annezazu annezazu added [Block] Navigation Affects the Navigation Block [Status] Needs More Info Follow-up required in order to be actionable. labels Jan 26, 2022
@getdave getdave changed the title Have different Mobile Menu page links vs the main navigation (At the moment the navigation blocks uses the same menu data for all screen sizes) Ability to have different links in the "mobile" menu vs the standard menu. Jan 27, 2022
@getdave
Copy link
Contributor

getdave commented Jan 27, 2022

@jamiemarsland it sounds like you want a way to conditionally show nav items based on screen size. Is that right? Just want to ensure the description is filled out.

Jame and I discussed this and yes that is what he's looking for.

Imagine the mobile menu needs to show slightly different items than the primary one. Currently you can't do that.

I do wonder about the a11y implications of this and whether what we actually need is a way to conditionally show/hide blocks depending on screen size. I don't think we'll be able to have different menus tied to the same block.

@getdave getdave added the Needs Design Feedback Needs general design feedback. label Jan 27, 2022
@jamiemarsland
Copy link
Author

This is incredibly important for larger sites e.g ecommerce sites that have mega menus as the main menu.

In the past this was handled by themes by having different menus assigned to different locations.

@getdave
Copy link
Contributor

getdave commented Jan 27, 2022

In the past this was handled by themes by having different menus assigned to different locations.

That's what I'm thinking. Perhaps having two seperate Navigation blocks but with different rules governing the block's display at different breakpoints.

If they are completed different menus then that's pretty valid although I'd like some a11y feedback before we look to implement anything.

@pixolin
Copy link

pixolin commented Jan 28, 2022

As a workaround :

  • Add two menus.
  • Define overlay menu "off" for one, "mobile" for the other.
  • Give both menu blocks an "additional CSS class" in the advanced pane.
  • Add a media query to your custom CSS showing one or the other menu depending on screen size.

Kudos to @getdave for providing a little tutorial on Youtube: https://youtu.be/dY3f8sHcAPA

@getdave
Copy link
Contributor

getdave commented Jan 28, 2022

As a workaround :

  • Add two menus.
  • Define overlay menu "off" for one, "mobile" for the other.
  • Give both menu blocks an "additional CSS class" in the advanced pane.
  • Add a media query to your custom CSS showing one or the other menu depending on screen size.

Good advice. What you describe here is what we could create as a Core feature without the need for the custom CSS.

@pixolin
Copy link

pixolin commented Jan 28, 2022

What you describe here is what we could create as a Core feature without the need for the custom CSS.

Only if you provide a setting for a break point, which so far has been different for every theme. Yet this would complicate things. I'm not sure, if wp_is_mobile() is reliable enough.
As a core feature I probably would prefer an extra option for the menu items "show in mobile/show in desktop"?

@aristath
Copy link
Member

I'm not sure, if wp_is_mobile() is reliable enough.

It's not. It's notoriously bad... It fails miserably when there is caching involved, reverse proxies and so on.
Jetpack has an improved method (see class-device-detection.php in the Jetpack plugn) but ultimately, any server-side implementation will suffer from caching etc.
Most browsers plan to deprecate user-agents due to privacy concerns so relying on CSS media queries is the safest and simplest method.

@github-actions
Copy link

Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Feb 13, 2022
@getdave getdave added [Type] Enhancement A suggestion for improvement. and removed [Status] Needs More Info Follow-up required in order to be actionable. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. labels Feb 14, 2022
@getdave
Copy link
Contributor

getdave commented Feb 14, 2022

I've updated the Issue. It's tracked in the Nav block tracking issue and so it's not stale.

@mtias mtias added Mobile Web Viewport sizes for mobile and tablet devices [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later labels May 27, 2022
@getdave
Copy link
Contributor

getdave commented Mar 17, 2023

Related #43852

@fabiankaegy
Copy link
Member

As per the comment from @getdave here: #43852 (comment) This was punted to a future release

@colorful-tones
Copy link
Member

Hi folks,
We are only one week away from the Beta 1 cut-off date for WordPress 6.6. This issue hasn’t seen any movement in a while, so we (the editor triage leads of the 6.6 release) have decided to remove it from the WordPress 6.6 Editor Tasks project board.

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 Mobile Web Viewport sizes for mobile and tablet devices Needs Design Feedback Needs general design feedback. [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

8 participants