feat: skip to main content button

pull/6486/head
Konstantinos Kaloutas 2022-08-24 11:50:45 +03:00 committed by Tienson Qin
parent 5ff79cbba0
commit c3799b3f23
3 changed files with 21 additions and 2 deletions

View File

@ -7,4 +7,4 @@ test('check a11y for the whole page', async ({ page }) => {
await injectAxe(page)
await createRandomPage(page)
await checkA11y(page)
})
})

View File

@ -602,7 +602,12 @@
{:class (util/classnames [{:ls-left-sidebar-open left-sidebar-open?
:ls-right-sidebar-open sidebar-open?
:ls-wide-mode wide-mode?}])}
[:button#skip-to-main
{:click #(.focus (gdom/getElement "#main-content-container"))
:on-key-press (fn [e]
(when (= (.-key e) "Enter")
(.focus (gdom/getElement "#main-content-container"))))}
"Skip to main content"]
[:div.#app-container
[:div#left-container
{:class (if (state/sub :ui/sidebar-open?) "overflow-hidden" "w-full")}

View File

@ -25,6 +25,20 @@
flex: 0 0 100%;
}
#skip-to-main {
@apply fixed p-2 rounded;
left: 50%;
transform: translate(-50%, 0);
background-color: var(--ls-secondary-background-color);
top: -100px;
z-index: 10000;
&:focus {
top: 20px;
}
}
#left-container {
@apply flex flex-1 flex-col relative h-screen;
}