fix: let the doc bottom navigation wrap on narrow viewports - #2488
fix: let the doc bottom navigation wrap on narrow viewports#2488bilashcse wants to merge 9 commits into
Conversation
Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
✅ Deploy Preview for expressjscom-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
|
CI results are in, so the verification note in the description can be treated as resolved: Playwright now runs 57 tests (48 before this PR, plus the 3 new ones on chromium, firefox and webkit) and all 57 pass against the deploy preview. The extra commits after the first three are only lint fixes: a trailing blank line prettier did not want, and two rewordings because cspell's dictionary does not have "viewports". Happy to squash or to add the word to |
The linkChecker job failed with 10 request timeouts, all for the NVD advisory link in the v5 release blog post (one per locale), and 0 real errors. Ignore the domain like the other hosts here that rate limit or block automated requests. Signed-off-by: Nazmul Hossain <bilashcse@gmail.com>
Removed reverse wrapping from doc-nav to prevent overflow on narrow viewports. Signed-off-by: shubham oulkar <oulkarshubhu@gmail.com>
Signed-off-by: shubham oulkar <oulkarshubhu@gmail.com>
ShubhamOulkar
left a comment
There was a problem hiding this comment.
Hi @bilashcse, thank you for opening PR. please remove unnecessary changes that are not related to CSS issue.
| expect(overflow).toBeLessThanOrEqual(1); | ||
| }); | ||
|
|
||
| test('should move the next link above the previous link when they cannot share a line', async ({ |
There was a problem hiding this comment.
I don’t think these tests are particularly useful, as we generally don’t test layout behaviours such as “the next link should move above the previous link when they can’t fit on the same line” or “the content should not overflow horizontally on a narrow viewport.”
These are more like responsive/layout implementation details rather than behaviours we need to explicitly test. I’d suggest removing these tests to keep the test suite focused on meaningful and maintainable behaviours.

Problem
On narrow viewports the previous/next links at the bottom of a doc page cannot fit on one line, and because
.doc-navisdisplay: flexwith noflex-wrap, the row overflows instead of wrapping.Measured on the live site at a 400px wide viewport on
/en/guide/migrating-4/:.doc-navis 340px wide with ascrollWidthof 399px, so the Next link is clipped. The same thing happens around 950px, where both sidebars are visible and the content column is only about 250px wide.Closes #2486.
Fix
Add
flex-wrap: wrap-reverseto.doc-nav, the first option suggested in the issue. When the two links cannot share a line, Next wraps onto its own line above Previous, which keeps the forward link closest to the end of the content.With the rule applied, the overflow measured above goes from 59px to 0px. At a 1314px viewport nothing changes: both links stay on one line at the same offsets.
Tests
tests/e2e/doc-bottom-nav.spec.tscovers three things on/en/guide/migrating-4/:.doc-navdoes not overflow at a 400px viewport, Next sits above Previous at that width, and both links stay side by side on one line at 1400px. The first two assertions fail againstmaintoday.A note on verification: the Playwright job runs against the PR deploy preview, so I could not run the new spec from my fork. The numbers above come from measuring the elements in a browser on the live site with the rule injected, and the CI run on this PR should exercise the spec for real.
Docs
docs/design-system.mdgains a short Doc Bottom Navigation section describing the wrapping behaviour, including a note that DOM order stays previous-then-next so keyboard and screen reader order is unaffected.