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

Navigation: Avoid layout shifts between placeholder and loaded menu #38980

Closed
jasmussen opened this issue Feb 22, 2022 · 1 comment
Closed

Navigation: Avoid layout shifts between placeholder and loaded menu #38980

jasmussen opened this issue Feb 22, 2022 · 1 comment
Labels
[Block] Navigation Affects the Navigation Block [Type] Enhancement A suggestion for improvement.

Comments

@jasmussen
Copy link
Contributor

jasmussen commented Feb 22, 2022

The new Navigation placeholder state is simpler, but is always 48px tall, which means when you load a menu that has a different size, there's a small layout shift.

We can optimize that so the container is the same height as an eventual menu will be. That should ensure a uniform height between placeholder, the spinner that might briefly get shown, and the loaded menu.

It likely won't always be perfect, for example if a menu is set to collapse to an overlay, or if a menu has more than 1 row of items, but that would be acceptable.

GIF showing 4 distinct heights of navigation:

  • Resting state (48px hard coded)
  • Loading state (same height as spinner)
  • Empty (24px inserter button height)
  • Menu (same height as an menu item)

shifts

One potential fix is to output a hidden menu item with zero width, and use that item to size out both the setup state, loading, and the empty states.

@jasmussen jasmussen added [Type] Enhancement A suggestion for improvement. [Block] Navigation Affects the Navigation Block labels Feb 22, 2022
@jasmussen
Copy link
Contributor Author

Moving towards a behavior where the placeholder is never shown with a fallback always in place, this is no longer relevant.

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 [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

1 participant