layout: measure the header nav rather than collapsing it at a breakpoint - #706
Merged
Merged
Conversation
|
🌐 Fork Preview for PR #706 https://pr-706.ddev-com-fork-previews.pages.dev This preview updates automatically when you push changes to your fork. |
## The Issue Follow-up to the review on ddev#704. The header nav and the blog post title both switched to their narrow layouts at `lg` (1024px). Browser zoom shrinks the viewport in CSS pixels, so at 110-125% a 1200px window falls under that and the nav collapsed wholesale under the menu button. `w-2/3` on the nav's right-hand wrapper capped its contents at two thirds of the container, which is why the threshold had to be that high. The menu behind that button was a `div` only the script could reveal, so with JavaScript off there was no way to reach the nav links below 1024px at all. The byline's edit link was anchored to the full 72rem `site-container` instead of the text, landing about 26rem past the end of it on posts with no feature image. ## How This PR Solves The Issue - Nav links come from one array rendered into both the bar and the menu. A script measures them and drops links from the end until the rest fit, moving each one into the menu. The button shows only when something is hidden. Without the script the markup still falls back to `hidden lg:flex`. - The menu is a `details`/`summary`, so it opens with JavaScript off and the script keeps no open/close code of its own. The separate close button is gone; the summary toggles. - Nothing in the bar may shrink, or the measurements come back compressed and report room that isn't there. The menu's width stays reserved while it's hidden, so the result can't oscillate. - `.title-grid` puts the blog title beside its feature image from 52rem, with the image column at `clamp(16rem, 36%, 25rem)` so it shrinks instead of stacking. - The byline row is capped at `--reading-measure`. ## Manual Testing Instructions Preview: https://pr-REPLACE_ME_WITH_PR_NUMBER.ddev-com-fork-previews.pages.dev/ 1. Drag the window from 1400px to 320px: links should leave the bar one at a time and appear in the menu, with the logo never compressed. 2. At 1200px, zoom to 110%, 125% and 150%: as many links as fit at each. 3. Compare `/blog/release-v1-25-3/` against a post with no feature image, at 1400px, 900px and 700px. 4. With JavaScript off: all links above 1024px, and below it the button opens the menu. ## Release/Deployment Notes None. 🤖 Developed with assistance from [Claude Code](https://claude.ai/code) Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
stasadev
force-pushed
the
20260730_stasadev_nav_overflow
branch
from
July 30, 2026 09:13
11c9503 to
c4bfa6a
Compare
rfay
approved these changes
Jul 30, 2026
rfay
left a comment
Member
There was a problem hiding this comment.
This looks fantastic on all the ones I spot-checked, thank you!
|
PR closed. The Cloudflare Pages preview is no longer updated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The Issue
Follow-up to the review on #704. The header nav and the blog post title both switched to their narrow layouts at
lg(1024px). Browser zoom shrinks the viewport in CSS pixels, so at 110-125% a 1200px window falls under that andthe nav collapsed wholesale under the menu button.
w-2/3on the nav's right-hand wrapper capped its contents at two thirds of the container, which is why the threshold had to be that high.The menu behind that button was a
divonly the script could reveal, so with JavaScript off there was no way to reach the nav links below 1024px at all.The byline's edit link was anchored to the full 72rem
site-containerinstead of the text, landing about 26rem past the end of it on posts with no feature image.How This PR Solves The Issue
Without the script the markup still falls back to
hidden lg:flex.details/summary, so it opens with JavaScript off and the script keeps no open/close code of its own. The separate close button is gone; the summary toggles..title-gridputs the blog title beside its feature image from 52rem, with the image column atclamp(16rem, 36%, 25rem)so it shrinks instead of stacking.--reading-measure.Manual Testing Instructions
Preview: https://pr-706.ddev-com-fork-previews.pages.dev/
/blog/release-v1-25-3/against a post with no feature image, at 1400px, 900px and 700px.Release/Deployment Notes
None.
🤖 Developed with assistance from Claude Code