From 8bd30ea3c23b4a68b0145f089c5ff0cc9d67dfb0 Mon Sep 17 00:00:00 2001 From: Cloyd Lau <31238760+cloydlau@users.noreply.github.com> Date: Mon, 1 Jul 2024 19:31:39 +0800 Subject: [PATCH 1/3] doc: avoid hiding by navigation bar in anchor jumping in 17.x --- doc/api_assets/style.css | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index 14302edc061a1d..7eae54683d171d 100644 --- a/doc/api_assets/style.css +++ b/doc/api_assets/style.css @@ -60,9 +60,16 @@ } /*--------------------- Layout and Typography ----------------------------*/ +@media (prefers-reduced-motion: no-preference) { + html { + scroll-behavior: smooth; + } +} + html { font-size: 1rem; overflow-wrap: break-word; + scroll-padding-top: 55px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-font-variant-ligatures: none; From 37391e29155a107f5a4452eba13d8a4245f1e5a6 Mon Sep 17 00:00:00 2001 From: Cloyd Lau <31238760+cloydlau@users.noreply.github.com> Date: Thu, 4 Jul 2024 22:53:05 +0800 Subject: [PATCH 2/3] doc: change the snippet above from 55px to 4rem, so that it scales more cleanly with font size adjustments --- doc/api_assets/style.css | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index 7eae54683d171d..5f870c7d05a902 100644 --- a/doc/api_assets/style.css +++ b/doc/api_assets/style.css @@ -40,6 +40,13 @@ --color-text-secondary: var(--green2); } +h2 :target, +h3 :target, +h4 :target, +h5 :target { + scroll-margin-top: 4rem; +} + .dark-mode { --background-color-highlight: var(--black2); --color-critical: var(--red4); @@ -60,16 +67,9 @@ } /*--------------------- Layout and Typography ----------------------------*/ -@media (prefers-reduced-motion: no-preference) { - html { - scroll-behavior: smooth; - } -} - html { font-size: 1rem; overflow-wrap: break-word; - scroll-padding-top: 55px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-font-variant-ligatures: none; From a5e56b935cf893793c17560bf0b4e23720f295ea Mon Sep 17 00:00:00 2001 From: Cloyd Lau <31238760+cloydlau@users.noreply.github.com> Date: Mon, 8 Jul 2024 12:47:06 +0800 Subject: [PATCH 3/3] doc: use `scroll-padding-top` on the document, remove `scroll-margin-top` on the headings --- doc/api_assets/style.css | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index 5f870c7d05a902..3ef9fdc9bb6628 100644 --- a/doc/api_assets/style.css +++ b/doc/api_assets/style.css @@ -40,13 +40,6 @@ --color-text-secondary: var(--green2); } -h2 :target, -h3 :target, -h4 :target, -h5 :target { - scroll-margin-top: 4rem; -} - .dark-mode { --background-color-highlight: var(--black2); --color-critical: var(--red4); @@ -67,9 +60,16 @@ h5 :target { } /*--------------------- Layout and Typography ----------------------------*/ +@media (prefers-reduced-motion: no-preference) { + html { + scroll-behavior: smooth; + } +} + html { font-size: 1rem; overflow-wrap: break-word; + scroll-padding-top: 4rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-font-variant-ligatures: none;