Local navigation block: Hide page title before collapsing menu #641
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #640, see See WordPress/Learn#2622. When elements (site title, page title, navigation) are too long, they can overlap or cause wrapping issues. In #573, the navigation menu collapsed when they would wrap, but in some cases this can cause the navigation to be hidden on more screen-sizes than is ideal. Instead, the navigation menu should be prioritized, and the page title can be hidden first.
This PR updates the logic, so that the page title is hidden first, extending the screen sizes that will see the correct desktop version of the nav bar. If the menu will still collide with the site title, it does collapse down into the chevron dropdown, but this is only at some screen sizes, since most site titles are short.
Screenshots
Screen recording of shrinking the screen from 1440px, with an exaggerated page title and menu length. The page title disappears around 1300px, and while the menu stays inline until around 970px (where it would otherwise run into the site title). Previously, the menu would collapse at that 1300 width. (Note that these breakpoints are relative to the page content, not universal)
local-nav-collapse.mp4
On a real page, the Learn menu is now visible here, where previously it collapsed on a larger screen size.
To test: