Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions packages/usa-nav/src/styles/_usa-nav.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:map";
@use "uswds-core" as *;

// Navigation helpers
Expand Down Expand Up @@ -475,19 +476,26 @@ $expand-less-icon: map-merge(
}

// Safari-only fix that forces a vertical scrollbar when mobile menu is open.
// Only needed in the 15px immediately preceding $theme-header-max-width.
// Only needed in the 15px immediately preceding $theme-header-min-width.
//
// Note: 15px is the current width of the Safari scrollbar.
// More details in https://github.com/uswds/uswds/pull/5443
$safari-header-bug-min-width: calc(
units($theme-header-max-width) - px-to-rem(15px)
);

@media (min-width: $safari-header-bug-min-width) {
.usa-js-mobile-nav--active.is-safari {
overflow-y: scroll;
position: fixed;
// --scrolltop set with JS with zero as fallback.
top: var(--scrolltop, 0);
// Note: This fix only applies when $theme-header-min-width is defined with a system breakpoint
// because the header visually breaks with other values.
// This bypass prevents compilation errors with values like "none" or 1px.

$our-breakpoints: map-deep-get($system-properties, breakpoints, standard);

@if map-has-key($our-breakpoints, $theme-header-min-width) {
$safari-header-bug-min-width: calc(
units($theme-header-min-width) - px-to-rem(15px)
);

@media (min-width: $safari-header-bug-min-width) {
.usa-js-mobile-nav--active.is-safari {
overflow-y: scroll;
position: fixed;
// --scrolltop set with JS with zero as fallback.
top: var(--scrolltop, 0);
}
}
}