|
| 1 | +@use "sass:map"; |
1 | 2 | @use "uswds-core" as *; |
2 | 3 |
|
3 | 4 | // Navigation helpers |
@@ -476,19 +477,26 @@ $expand-less-icon: map-merge( |
476 | 477 | } |
477 | 478 |
|
478 | 479 | // Safari-only fix that forces a vertical scrollbar when mobile menu is open. |
479 | | -// Only needed in the 15px immediately preceding $theme-header-max-width. |
| 480 | +// Only needed in the 15px immediately preceding $theme-header-min-width. |
480 | 481 | // |
481 | 482 | // Note: 15px is the current width of the Safari scrollbar. |
482 | | -// More details in https://github.com/uswds/uswds/pull/5443 |
483 | | -$safari-header-bug-min-width: calc( |
484 | | - units($theme-header-max-width) - px-to-rem(15px) |
485 | | -); |
486 | | - |
487 | | -@media (min-width: $safari-header-bug-min-width) { |
488 | | - .usa-js-mobile-nav--active.is-safari { |
489 | | - overflow-y: scroll; |
490 | | - position: fixed; |
491 | | - // --scrolltop set with JS with zero as fallback. |
492 | | - top: var(--scrolltop, 0); |
| 483 | +// Note: This fix only applies when $theme-header-min-width is defined with a system breakpoint |
| 484 | +// because the header visually breaks with other values. |
| 485 | +// This bypass prevents compilation errors with values like "none" or 1px. |
| 486 | + |
| 487 | +$our-breakpoints: map-deep-get($system-properties, breakpoints, standard); |
| 488 | + |
| 489 | +@if map-has-key($our-breakpoints, $theme-header-min-width) { |
| 490 | + $safari-header-bug-min-width: calc( |
| 491 | + units($theme-header-min-width) - px-to-rem(15px) |
| 492 | + ); |
| 493 | + |
| 494 | + @media (min-width: $safari-header-bug-min-width) { |
| 495 | + .usa-js-mobile-nav--active.is-safari { |
| 496 | + overflow-y: scroll; |
| 497 | + position: fixed; |
| 498 | + // --scrolltop set with JS with zero as fallback. |
| 499 | + top: var(--scrolltop, 0); |
| 500 | + } |
493 | 501 | } |
494 | 502 | } |
0 commit comments