From cfa5cb7b47c26970d9a21552719264214181c30f Mon Sep 17 00:00:00 2001 From: WilcoSp Date: Sat, 14 Feb 2026 11:32:31 +0100 Subject: [PATCH 1/2] fix: adding scroll margin to prevent header being over the scrolled to content --- .../[packageName]/v/[version]/[...filePath].vue | 1 + app/pages/package-docs/[...path].vue | 1 + app/pages/package/[[org]]/[name]/index.vue | 1 + app/router.options.ts | 9 +++++++-- app/types/routeMeta.ts | 14 ++++++++++++++ 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 app/types/routeMeta.ts diff --git a/app/pages/package-code/[[org]]/[packageName]/v/[version]/[...filePath].vue b/app/pages/package-code/[[org]]/[packageName]/v/[version]/[...filePath].vue index 7d42e6ef3..2202494d7 100644 --- a/app/pages/package-code/[[org]]/[packageName]/v/[version]/[...filePath].vue +++ b/app/pages/package-code/[[org]]/[packageName]/v/[version]/[...filePath].vue @@ -13,6 +13,7 @@ definePageMeta({ '/package/code/:packageName/v/:version/:filePath(.*)?', // '/code/@:org?/:packageName/v/:version/:filePath(.*)?', ], + scrollMargin: 160, }) const route = useRoute('code') diff --git a/app/pages/package-docs/[...path].vue b/app/pages/package-docs/[...path].vue index fe60f7fb0..da1038e34 100644 --- a/app/pages/package-docs/[...path].vue +++ b/app/pages/package-docs/[...path].vue @@ -7,6 +7,7 @@ definePageMeta({ name: 'docs', path: '/package-docs/:path+', alias: ['/package/docs/:path+', '/docs/:path+'], + scrollMargin: 180, }) const route = useRoute('docs') diff --git a/app/pages/package/[[org]]/[name]/index.vue b/app/pages/package/[[org]]/[name]/index.vue index 20f211960..ba122fbfc 100644 --- a/app/pages/package/[[org]]/[name]/index.vue +++ b/app/pages/package/[[org]]/[name]/index.vue @@ -2,6 +2,7 @@ // stub page to help with paths definePageMeta({ name: 'package', + scrollMargin: 150, }) diff --git a/app/router.options.ts b/app/router.options.ts index 180dd68e9..a6d9db7cc 100644 --- a/app/router.options.ts +++ b/app/router.options.ts @@ -3,13 +3,18 @@ import type { RouterConfig } from 'nuxt/schema' export default { scrollBehavior(to, _from, savedPosition) { // If the browser has a saved position (e.g. back/forward navigation), restore it + if (savedPosition) { return savedPosition } - // If navigating to a hash anchor, scroll to it if (to.hash) { - return { el: to.hash, behavior: 'smooth' } + const { scrollMargin } = to.meta + return { + el: to.hash, + behavior: 'smooth', + top: typeof scrollMargin == 'number' ? scrollMargin : 70, + } } // Otherwise, scroll to the top of the page diff --git a/app/types/routeMeta.ts b/app/types/routeMeta.ts new file mode 100644 index 000000000..a757bcc21 --- /dev/null +++ b/app/types/routeMeta.ts @@ -0,0 +1,14 @@ +import '#app' +import '#vue-router' + +declare module '#app' { + interface PageMeta { + /** + * top margin in pixels for scrolling to an element + * @default 70 + */ + scrollMargin?: number + } +} + + From 65bc489847f12199ec669527f83de5a7d2c4105b Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sat, 14 Feb 2026 10:52:22 +0000 Subject: [PATCH 2/2] [autofix.ci] apply automated fixes --- app/types/routeMeta.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/types/routeMeta.ts b/app/types/routeMeta.ts index a757bcc21..491bd5a99 100644 --- a/app/types/routeMeta.ts +++ b/app/types/routeMeta.ts @@ -10,5 +10,3 @@ declare module '#app' { scrollMargin?: number } } - -