From d5b0e4d9da26e972f2251334ee609c79897c90b5 Mon Sep 17 00:00:00 2001 From: Luffy <52o@qq52o.cn> Date: Fri, 8 Aug 2025 12:50:40 +0800 Subject: [PATCH 1/2] fix: enhance focus handling --- docs/_coverpage.md | 2 +- src/core/event/index.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/_coverpage.md b/docs/_coverpage.md index e9292beaf..654bda622 100644 --- a/docs/_coverpage.md +++ b/docs/_coverpage.md @@ -2,7 +2,7 @@  -# docsify 5.0.0-rc.1 +# docsify 5.0.0-rc.1 :id=docsify > A magical documentation site generator diff --git a/src/core/event/index.js b/src/core/event/index.js index f1a55715a..e14ecf365 100644 --- a/src/core/event/index.js +++ b/src/core/event/index.js @@ -416,9 +416,16 @@ export function Events(Base) { // Move focus to content area if (focusEl) { - focusEl.focus(settings); + if (!focusEl.hasAttribute('tabindex')) { + focusEl.setAttribute('tabindex', '-1'); + focusEl.setAttribute('data-added-tabindex', 'true'); + } - focusEl.scrollIntoView({ behavior: 'smooth', block: 'start' }); + if (focusEl.hasAttribute('data-added-tabindex')) { + focusEl.scrollIntoView({ behavior: 'smooth' }); + } + + focusEl.focus(settings); } return focusEl; From 22bdc847c0e438b21cfaa5b31f9b8c61f58de4b8 Mon Sep 17 00:00:00 2001 From: Luffy <52o@qq52o.cn> Date: Fri, 8 Aug 2025 12:53:54 +0800 Subject: [PATCH 2/2] fix: update anchor ID for documentation header --- test/integration/__snapshots__/docs.test.js.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/__snapshots__/docs.test.js.snap b/test/integration/__snapshots__/docs.test.js.snap index ce0dc1978..26f170ded 100644 --- a/test/integration/__snapshots__/docs.test.js.snap +++ b/test/integration/__snapshots__/docs.test.js.snap @@ -5,7 +5,7 @@ exports[`Docs Site coverpage renders and is unchanged 1`] = `
+
docsify 5.0.0-rc.1
A magical documentation site generator
- Simple and lightweight
- No statically built HTML files
- Multiple themes