Skip to content

Commit 2e3be51

Browse files
committed
🇳🇫 Better CSS for reduced-motion scroll
1 parent 2ef24c1 commit 2e3be51

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

assets/scss/partials/_elements.scss

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
// Smooth scrolling
2-
html {
3-
scroll-behavior: smooth;
4-
}
5-
6-
// No smooth scrolling for users who want reduced motion
7-
@media screen and (prefers-reduced-motion: reduce) {
1+
// smooth scrolling only if users don't have a prefers-reduced-motion option
2+
@media (prefers-reduced-motion: no-preference) {
83
html {
9-
scroll-behavior: auto;
4+
scroll-behavior: smooth;
105
}
116
}
127

0 commit comments

Comments
 (0)