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 @@ ![logo](_media/icon.svg) -# 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; 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`] = `
-

logo

docsify 5.0.0-rc.1

+

logo

docsify 5.0.0-rc.1

A magical documentation site generator

Get Started GitHub