From 52c4af07cd44cd8654155636c52430be1697e2a8 Mon Sep 17 00:00:00 2001 From: Matthew Passmore Date: Thu, 2 Apr 2020 16:43:42 +0100 Subject: [PATCH] Fix viewport smooth scroll-behavior The 'scroll-behavior' property of the HTML `body` element is not propagated to the viewport. When applied to the root element, it applies to the viewport. @link https://drafts.csswg.org/cssom-view/#smooth-scrolling --- dist/reset.css | 6 +++++- dist/reset.min.css | 2 +- src/reset.css | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dist/reset.css b/dist/reset.css index ac41cf2..bf2e101 100644 --- a/dist/reset.css +++ b/dist/reset.css @@ -27,10 +27,14 @@ dd { margin: 0; } +/* Set core root defaults */ +html { + scroll-behavior: smooth; +} + /* Set core body defaults */ body { min-height: 100vh; - scroll-behavior: smooth; text-rendering: optimizeSpeed; line-height: 1.5; } diff --git a/dist/reset.min.css b/dist/reset.min.css index dab82de..d17a60a 100644 --- a/dist/reset.min.css +++ b/dist/reset.min.css @@ -1 +1 @@ -*,*::before,*::after{box-sizing:border-box}ul[class],ol[class]{padding:0}body,h1,h2,h3,h4,p,ul[class],ol[class],figure,blockquote,dl,dd{margin:0}body{min-height:100vh;scroll-behavior:smooth;text-rendering:optimizeSpeed;line-height:1.5}ul[class],ol[class]{list-style:none}a:not([class]){text-decoration-skip-ink:auto}img{max-width:100%;display:block}article>*+*{margin-top:1em}input,button,textarea,select{font:inherit}img:not([alt]){filter:blur(10px)}@media(prefers-reduced-motion:reduce){*{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important}} +*,*::before,*::after{box-sizing:border-box}ul[class],ol[class]{padding:0}body,h1,h2,h3,h4,p,ul[class],ol[class],figure,blockquote,dl,dd{margin:0}html{scroll-behavior:smooth}body{min-height:100vh;text-rendering:optimizeSpeed;line-height:1.5}ul[class],ol[class]{list-style:none}a:not([class]){text-decoration-skip-ink:auto}img{max-width:100%;display:block}article>*+*{margin-top:1em}input,button,textarea,select{font:inherit}img:not([alt]){filter:blur(10px)}@media(prefers-reduced-motion:reduce){*{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important}} diff --git a/src/reset.css b/src/reset.css index ac41cf2..bf2e101 100644 --- a/src/reset.css +++ b/src/reset.css @@ -27,10 +27,14 @@ dd { margin: 0; } +/* Set core root defaults */ +html { + scroll-behavior: smooth; +} + /* Set core body defaults */ body { min-height: 100vh; - scroll-behavior: smooth; text-rendering: optimizeSpeed; line-height: 1.5; }