Gutenberg: Navigation block item breaks on mobile

Created on 8 Nov 2019  路  7Comments  路  Source: WordPress/gutenberg

Describe the bug
When inserting or editing a navigation item on mobile, the toolbar of the menu item breaks on multiple lines.

Expected behavior
It should stick to the bottom of the navigation menu block instead of being anchored to the navigation menu item.

Screenshots

Screenshot 2019-11-08 at 15 30 56

Smartphone (please complete the following information):

  • Device: IPhone Simulator
[Type] Bug

Most helpful comment

We're working on the mobile toolbar over in https://github.com/WordPress/gutenberg/pull/18686. This is what the navigation block looks like on mobile with the current state of that PR.

ezgif com-video-to-gif (3)

So if we can land the changes we're attempting to make to the mobile toolbar in general, this should also fix the UX issues we're seeing with the navigation block submenu toolbars.

All 7 comments

It should stick to the bottom of the navigation menu block instead of being anchored to the navigation menu item.

@draganescu This relates to

https://github.com/WordPress/gutenberg/pull/18336#issuecomment-551880816

@mtias is there any precedent for this behaviour for nested Blocks' toolbars?

@shaunandrews looping you in for this as my feelings are we might have to simplify things or at least look at stopping overlaps.

68602276-f41ae000-049d-11ea-8387-10759e581d09

68602240-e6fdf100-049d-11ea-9112-2ec2ddda9bd4

68602206-d64d7b00-049d-11ea-98cc-0c7d90af497b

68602182-cdf54000-049d-11ea-853d-f1a26e33627f

At the _very least_ the Link UI needs to better adjust on mobile screens鈥攑erhaps a modal overlay, instead of the positional popover.

In the screenshots above, it seems like some of the spacing and positioning of the toolbar is just plain broken. This doesn't appear to be a problem specific to the Navigation block (though it is definitely impacted) and is more related to nested blocks in general聽鈥斅爐he toolbar tries to respect the nested paddings/margins.

Instead, I think the toolbar should always be positioned to the left edge of small viewports and likely full-width.

I just had a brief look at the issue and what seems to happen is the following:

On other blocks, we make use of absolute positioning for the toolbar to appear below the block. That works well for the main toolbar of this block as well but breaks down for the toolbar on the individual items:

mobile-subnav-current

That is because for the individual items there are now a few different elements in between that set position relative. We could reset those to the initial state on mobile. That would somewhat work but it breaks down the moment the user would click the button to toggle the item position. The issue there is that the transform creates a new stacking context. So the item changes position during the animation and then jumps to full width the moment the animation stops:

mobile-stacking-context-issue

With this in mind, what would probably be the most straightforward solution, for now, is to make each of the menu items full width on mobile. This way each block stretches over the full width and the toolbar can just be positioned at the bottom of the menu item just as with any other block.

make each of the menu items full width on mobile.

Interesting exploration @frontdevde, thank you! I believe this idea above is a good approach since usually navigation at mobile phone breakpoints is indeed stacked.

We're working on the mobile toolbar over in https://github.com/WordPress/gutenberg/pull/18686. This is what the navigation block looks like on mobile with the current state of that PR.

ezgif com-video-to-gif (3)

So if we can land the changes we're attempting to make to the mobile toolbar in general, this should also fix the UX issues we're seeing with the navigation block submenu toolbars.

Fixed by #18686

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ellatrix picture ellatrix  路  3Comments

spocke picture spocke  路  3Comments

aaronjorbin picture aaronjorbin  路  3Comments

youknowriad picture youknowriad  路  3Comments

franz-josef-kaiser picture franz-josef-kaiser  路  3Comments