Skip to content

Commit

Permalink
Respect prefers-reduced-motion when adding motion.
Browse files Browse the repository at this point in the history
  • Loading branch information
frjo committed Jan 5, 2024
1 parent 5c62458 commit 4bd1e30
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 0 additions & 2 deletions assets/sass/_reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ html {
min-height: 100%;
// Use the saner border-box model.
box-sizing: border-box;
// Use smooth scrolling.
scroll-behavior: smooth;
// Improve text rendering.
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
Expand Down
8 changes: 8 additions & 0 deletions assets/sass/base/links/_links.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ a:active {
text-decoration: none;
}

// Use smooth scrolling unless user prefer less motion.
@media (prefers-reduced-motion: no-preference) {
:has(:target) {
scroll-behavior: smooth;
scroll-padding-block-start: var(--gutters);
}
}

.link-nav,
%link-nav {
a {
Expand Down
9 changes: 6 additions & 3 deletions assets/sass/mobile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,13 @@
&__toggle,
&__hamburger rect,
&__sheet {
transition: all 130ms ease-in;
// Add some transitions unless user prefer less motion.
@media (prefers-reduced-motion: no-preference) {
transition: all 130ms ease-in;

.js-nav-open & {
transition: all 330ms ease-out;
.js-nav-open & {
transition: all 330ms ease-out;
}
}
}
}

0 comments on commit 4bd1e30

Please sign in to comment.