From 6aed477cc942f38e1d660bbeb734fad75c0e1fb5 Mon Sep 17 00:00:00 2001 From: David Darnes Date: Thu, 14 Jan 2021 10:52:24 +0000 Subject: [PATCH 1/4] Only allow smooth scrolling when focused in the page --- src/reset.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reset.css b/src/reset.css index 9dde13c..854dc7a 100644 --- a/src/reset.css +++ b/src/reset.css @@ -26,7 +26,7 @@ ol[role="list"] { } /* Set core root defaults */ -html { +html:focus-within { scroll-behavior: smooth; } From 24f527e41419841b06eac09c8f07b3139cb867a1 Mon Sep 17 00:00:00 2001 From: David Darnes Date: Thu, 14 Jan 2021 11:00:33 +0000 Subject: [PATCH 2/4] Prevent smooth scrolling for people who prefer reduced motion --- src/reset.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/reset.css b/src/reset.css index 854dc7a..f3d489c 100644 --- a/src/reset.css +++ b/src/reset.css @@ -59,6 +59,9 @@ select { /* Remove all animations and transitions for people that prefer not to see them */ @media (prefers-reduced-motion: reduce) { + html:focus-within { + scroll-behavior: auto; + } *, *::before, *::after { From d60c41c896705c326ee306920a77ddbaf6df7fd3 Mon Sep 17 00:00:00 2001 From: Andy Bell Date: Mon, 18 Jan 2021 10:45:18 +0000 Subject: [PATCH 3/4] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1eb7629..cdfb2e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "modern-css-reset", - "version": "1.3.0", + "version": "1.4.0", "description": "A bare-bones CSS reset for modern web development", "main": "./dist/reset.min.css", "scripts": { From 3d88ede3e1592cbd4136cb696c28d8023cc115f1 Mon Sep 17 00:00:00 2001 From: Andy Bell Date: Mon, 18 Jan 2021 10:46:25 +0000 Subject: [PATCH 4/4] Buildy McBuildFace --- dist/reset.css | 5 ++++- dist/reset.min.css | 2 +- package-lock.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dist/reset.css b/dist/reset.css index 9dde13c..f3d489c 100644 --- a/dist/reset.css +++ b/dist/reset.css @@ -26,7 +26,7 @@ ol[role="list"] { } /* Set core root defaults */ -html { +html:focus-within { scroll-behavior: smooth; } @@ -59,6 +59,9 @@ select { /* Remove all animations and transitions for people that prefer not to see them */ @media (prefers-reduced-motion: reduce) { + html:focus-within { + scroll-behavior: auto; + } *, *::before, *::after { diff --git a/dist/reset.min.css b/dist/reset.min.css index d65626c..de3be44 100644 --- a/dist/reset.min.css +++ b/dist/reset.min.css @@ -1 +1 @@ -*,*::before,*::after{box-sizing:border-box}body,h1,h2,h3,h4,p,figure,blockquote,dl,dd{margin:0}ul[role="list"],ol[role="list"]{list-style:none}html{scroll-behavior:smooth}body{min-height:100vh;text-rendering:optimizeSpeed;line-height:1.5}a:not([class]){text-decoration-skip-ink:auto}img,picture{max-width:100%;display:block}input,button,textarea,select{font:inherit}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important}} +*,*::before,*::after{box-sizing:border-box}body,h1,h2,h3,h4,p,figure,blockquote,dl,dd{margin:0}ul[role="list"],ol[role="list"]{list-style:none}html:focus-within{scroll-behavior:smooth}body{min-height:100vh;text-rendering:optimizeSpeed;line-height:1.5}a:not([class]){text-decoration-skip-ink:auto}img,picture{max-width:100%;display:block}input,button,textarea,select{font:inherit}@media(prefers-reduced-motion:reduce){html:focus-within{scroll-behavior:auto}*,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important}} diff --git a/package-lock.json b/package-lock.json index 0344f92..89ccd2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "modern-css-reset", - "version": "1.0.4", + "version": "1.4.0", "lockfileVersion": 1, "requires": true, "dependencies": {