Skip to content

Commit 9333223

Browse files
committed
fix(nav): prevent mobile top bar overflow on narrow phones
The mobile nav was overflowing on narrow viewports: "Tools ▼" wrapped (arrow dropped to a second line) and the language switcher clipped off the right edge of the screen. Root cause: no nowrap on inline items, desktop-sized margins/padding applied to phone widths, and too many items competing for space on <420px screens. - Add `white-space: nowrap` and `flex-shrink: 0` to .logo, .navLink, .dropdownWrapper, .dropdownButton so labels can't wrap or be crushed by siblings. - New ≤520px breakpoint: tighter container padding, tighter link padding, and smaller inter-item margins. - New ≤420px breakpoint: hide the Contact link entirely (still reachable from the footer) so the language switcher has room. - Apply a new .contactLink modifier class in Nav.tsx so the media query has a scoped target. Verified at 320/375/414/480/768px — zero children overflow the viewport, Tools button stays on one line, EN switcher fully visible.
1 parent 879297d commit 9333223

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

src/components/layout/Nav.module.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
color: var(--text-primary);
2828
text-decoration: none;
2929
letter-spacing: 0.02em;
30+
white-space: nowrap;
31+
flex-shrink: 0;
3032
}
3133

3234
.logoIcon {
@@ -50,6 +52,8 @@
5052
padding: var(--space-xs) var(--space-sm);
5153
border-radius: var(--radius-sm);
5254
transition: color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
55+
white-space: nowrap;
56+
flex-shrink: 0;
5357
}
5458

5559
.navLink:hover {
@@ -68,6 +72,7 @@
6872
align-self: stretch;
6973
display: flex;
7074
align-items: center;
75+
flex-shrink: 0;
7176
}
7277

7378
.dropdownButton {
@@ -79,6 +84,7 @@
7984
padding: var(--space-xs) var(--space-sm);
8085
border-radius: var(--radius-sm);
8186
transition: color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
87+
white-space: nowrap;
8288
}
8389

8490
.dropdownButton:hover {
@@ -251,6 +257,32 @@
251257
}
252258
}
253259

260+
/* Phone: tighten spacing so Tools / Glossary / Contact / Language
261+
all fit inside the viewport. Contact is still reachable from the
262+
footer, so hiding it on very narrow screens is the least-lossy
263+
way to keep the language switcher from clipping off-screen. */
264+
@media (max-width: 520px) {
265+
.navInner {
266+
padding: 0 var(--space-sm);
267+
}
268+
.navLink,
269+
.dropdownWrapper {
270+
margin-left: var(--space-sm);
271+
}
272+
.navLink {
273+
padding: var(--space-xs) 6px;
274+
}
275+
.dropdownButton {
276+
padding: var(--space-xs) 6px;
277+
}
278+
}
279+
280+
@media (max-width: 420px) {
281+
.contactLink {
282+
display: none;
283+
}
284+
}
285+
254286
@media (max-width: 767px) {
255287
.megaMenu {
256288
position: fixed;

src/components/layout/Nav.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export function Nav({ theme, onThemeChange }: NavProps) {
184184
onClick={() => trackNavClick({ target: 'glossary', source: 'mega-menu' })}
185185
>{t('glossary')}</Link>
186186
<div className={styles.spacer} />
187-
<Link href="/contact" prefetch={false} className={styles.navLink}>{t('contact')}</Link>
187+
<Link href="/contact" prefetch={false} className={`${styles.navLink} ${styles.contactLink}`}>{t('contact')}</Link>
188188
<span className={styles.desktopThemeToggle}><ThemeToggle theme={theme} onChange={onThemeChange} /></span>
189189
<LanguageSwitcher />
190190
</div>

0 commit comments

Comments
 (0)