Skip to content

Commit

Permalink
navigation: animate side nav hiding as progressive enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
Dierk Koenig committed Dec 14, 2024
1 parent 1ba3cb5 commit 3879440
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 9 additions & 1 deletion docs/css/kolibri-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,20 @@ label + span > input:invalid + span.invalidation_marker {
}
}


/* --- standard values --- */
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0.01ms ;
}
}
:root {
/*
Needed to animate e.g. from height:0 to height:auto.
Works in Chrome but does not work in FF, Safari yet (dec.24).
*/
interpolate-size: allow-keywords; /* progressive enhancement*/
}
/* --- end of standard values --- */

/* --- a11y support: the "skip" link --- */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const projectorStyle = `
<style data-style-id="${PAGE_CLASS}">
@layer navigationLayer {
.${PAGE_CLASS} {
overflow-x: clip;
&.hide {
.toggler {
rotate: 0deg;
Expand All @@ -98,7 +99,7 @@ const projectorStyle = `
width: 2rem;
aspect-ratio: 1 / 1;
rotate: 180deg;
transition: rotate .3s ease-in-out;
transition: rotate .3s ease-in-out .1s; /* delayed and shorter than the width transition */
}
svg {
fill: none;
Expand All @@ -107,11 +108,16 @@ const projectorStyle = `
stroke-linejoin: round;
}
a {
width: auto;
color: revert;
pointer-events: revert;
user-select: none;
text-wrap: nowrap;
font-family: system-ui;
transition-property: width;
transition-duration: .5s;
transition-timing-function: ease-out;
transition-behavior: allow-discrete; /* progressive enhancement*/
}
a.visited {
text-decoration: none;
Expand Down

0 comments on commit 3879440

Please sign in to comment.