vanilla-framework icon indicating copy to clipboard operation
vanilla-framework copied to clipboard

Improve alignment of top navigation items with grid

Open bartaz opened this issue 2 years ago • 4 comments

Context

Padding in top navigation items is different from padding on the grid. We want text of first item of top navigation to align with the content on the page below it. Hoverbox of the item should stick outside of the grid (text is aligned, but navigation items actually expands to the left).

Currently, because padding on item and grid are different they would misalign like this (if we align navigation with outside margin of the grid:

image

Or like this (if we align both using same grid padding):

image

Visual

On canonical.com it's hacked with some undocumented usage of grid in top navigation and negative margin: image

We want to achieve this in docs layout as well (currently local styles):

image

We need to update the top navigation to improve the alignment with the grid below it, while making sure it still works on small screens and doesn't affect older websites that may still use old layout.

bartaz avatar Oct 18 '23 12:10 bartaz

Maybe we can modify the hover/active state to not use padding-left: image (Just a thought, we need to discuss this in the Design team)

lyubomir-popov avatar Oct 18 '23 15:10 lyubomir-popov

Another (relatively simple to implement) solution could be to increase hover area padding to 1.5rem (making it the same as grid margin) so that it aligns naturaly:

image

Although it does create 3rem space between unselected navigation items making it probably wider than needed (and may make some sites not fit their navigation - although we did increase the grid width in 4.0 so we have more space there).

bartaz avatar Oct 19 '23 07:10 bartaz

THat works for me. We've increased the fixed width fro m72 to 80 rem, which should compensate. Happy to go with that but we need to test maas and other sites with large numbers of menu items

lyubomir-popov avatar Oct 19 '23 11:10 lyubomir-popov

In JIRA as: WD-8284

bartaz avatar Jan 16 '24 15:01 bartaz

Done

bartaz avatar Sep 24 '24 09:09 bartaz

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/WD-15244.

This message was autogenerated