diff --git a/_assets/styles/_nav.scss b/_assets/styles/_nav.scss index 9815609c2..1874efcdc 100644 --- a/_assets/styles/_nav.scss +++ b/_assets/styles/_nav.scss @@ -1,24 +1,113 @@ +// A sharp decelerate: the panel arrives, then settles. +$sidebar-slide-time: 350ms; +$sidebar-slide: $sidebar-slide-time cubic-bezier(0, 0, 0.21, 1); + +// Without `manipulation`, Safari holds a tap for a third of a second in +// case a double-tap to zoom follows, and a second tap inside that wait +// cancels both. iOS ignores the viewport's scale limits, so nothing else +// turns it off. +.navbar-toggler { + position: relative; + touch-action: manipulation; +} + +// 48px is the smallest tap target recommended. The reach grows past the +// button, so nothing drawn changes. +.navbar-toggler::after { + position: absolute; + inset: 50% auto auto 50%; + width: 48px; + height: 48px; + content: ''; + transform: translate(-50%, -50%); +} + .navbar-toggler svg { height: 24px; } -.navbar-toggler-wrapper { - display: flex; - flex-direction: row-reverse; - height: $navbar-height; +// Focus lands on both of these without a press. Only a keyboard needs the +// ring. +.navbar-toggler:focus:not(:focus-visible) { + box-shadow: none; } -bento-sidebar { +.sidebar:focus:not(:focus-visible) { + outline: none; +} + +// Under the navbar, so the button keeps its place and the panel never +// crosses it. +.sidebar { + position: fixed; + inset-block: 0; + inset-inline-end: 0; + z-index: $zindex-fixed - 5; + visibility: hidden; + width: min(15rem, 70vw); + padding-top: $navbar-height; + overflow: hidden auto; + overscroll-behavior: contain; background-color: $secondary; + transform: translateX(100%); + transition: + transform $sidebar-slide, + visibility 0s linear $sidebar-slide-time; +} - .nav-link { - padding-left: 2rem; - line-height: 32px; - border-left: 2px solid transparent; - } +// The trailing edge is the left one in a page that reads right to left, so +// the panel leaves that way. +[dir='rtl'] .sidebar { + transform: translateX(-100%); +} + +.sidebar.is-open { + visibility: visible; + transform: none; + transition: transform $sidebar-slide; +} + +.sidebar .nav-link { + padding-left: 2rem; + line-height: 32px; + border-left: 2px solid transparent; +} + +.sidebar .nav-link.active { + border-left-color: $primary; +} + +.sidebar-backdrop { + position: fixed; + inset: 0; + z-index: $zindex-fixed - 10; + visibility: hidden; + + // A drag here scrolls nothing: `overflow: hidden` on the body does not + // hold on iOS. + touch-action: none; + background-color: rgb(0 0 0 / 50%); + opacity: 0; + transition: + opacity $sidebar-slide, + visibility 0s linear $sidebar-slide-time; +} + +.sidebar-backdrop.is-open { + visibility: visible; + opacity: 1; + transition: opacity $sidebar-slide; +} + +// The drawer scrolls itself, so the page behind it should not. +body.sidebar-open { + overflow: hidden; +} - .nav-link.active { - border-left-color: $primary; +@media (prefers-reduced-motion: reduce) { + .sidebar, + .sidebar-backdrop { + transition: none; } } diff --git a/_includes/assets/img/sublime-theme/hamburger-primary.svg b/_includes/assets/img/sublime-theme/hamburger-primary.svg deleted file mode 100644 index fb219ad19..000000000 --- a/_includes/assets/img/sublime-theme/hamburger-primary.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/_includes/footer.liquid b/_includes/footer.liquid index f325beeec..ab93e2a39 100644 --- a/_includes/footer.liquid +++ b/_includes/footer.liquid @@ -5,16 +5,54 @@ diff --git a/_includes/head.liquid b/_includes/head.liquid index 95756fbbe..3dc66394a 100644 --- a/_includes/head.liquid +++ b/_includes/head.liquid @@ -1,9 +1,10 @@ - + {%- comment -%} + No scale limits: iOS ignores them, and elsewhere they take pinch-zoom + from anyone who needs it. + {%- endcomment -%} + {%- endif -%} - - - - - @@ -36,21 +39,12 @@ - +{%- comment -%} + The header's button is the only control, so nothing moves under a finger. +{%- endcomment -%} + + diff --git a/project-terms.txt b/project-terms.txt index 2a8fe1d8e..70623ac52 100644 --- a/project-terms.txt +++ b/project-terms.txt @@ -46,9 +46,7 @@ Kosic lede middot noarchive -nodisplay noindex -nomodule nonoptional noopener noreferrer @@ -77,9 +75,11 @@ sitewide skipcq stylesheet Sysnative +tabindex tamasfe trixie unconfigured unentitled unifiedjs windir +zindex