mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
web/settings: focus the page after navigation
mobile: focus page header desktop: focus page content
This commit is contained in:
parent
c9ca0d51d9
commit
1234cc1083
2 changed files with 28 additions and 10 deletions
|
@ -366,6 +366,18 @@
|
||||||
margin-block: 0;
|
margin-block: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:global(
|
||||||
|
h1:focus-visible,
|
||||||
|
h2:focus-visible,
|
||||||
|
h3:focus-visible,
|
||||||
|
h4:focus-visible,
|
||||||
|
h5:focus-visible,
|
||||||
|
h6:focus-visible,
|
||||||
|
main:focus-visible
|
||||||
|
) {
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
:global(h1) {
|
:global(h1) {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
letter-spacing: -1px;
|
letter-spacing: -1px;
|
||||||
|
|
|
@ -29,16 +29,17 @@
|
||||||
|
|
||||||
$: currentPageTitle = $page.url.pathname.split("/").at(-1);
|
$: currentPageTitle = $page.url.pathname.split("/").at(-1);
|
||||||
$: stringPageTitle =
|
$: stringPageTitle =
|
||||||
currentPageTitle !== "settings" ? ` / ${$t(`settings.page.${currentPageTitle}`)}` : "";
|
currentPageTitle !== "settings"
|
||||||
|
? ` / ${$t(`settings.page.${currentPageTitle}`)}`
|
||||||
|
: "";
|
||||||
|
|
||||||
$: isMobile = screenWidth <= 750;
|
$: isMobile = screenWidth <= 750;
|
||||||
$: isHome = $page.url.pathname === '/settings';
|
$: isHome = $page.url.pathname === "/settings";
|
||||||
$: {
|
$: {
|
||||||
if (!isMobile && isHome) {
|
if (!isMobile && isHome) {
|
||||||
goto(defaultSettingsPage(), { replaceState: true });
|
goto(defaultSettingsPage(), { replaceState: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
|
@ -63,7 +64,12 @@
|
||||||
<IconArrowLeft />
|
<IconArrowLeft />
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
<h3 id="settings-page-title" aria-level="1">
|
<h3
|
||||||
|
id="settings-page-title"
|
||||||
|
aria-level="1"
|
||||||
|
data-first-focus
|
||||||
|
tabindex="-1"
|
||||||
|
>
|
||||||
{#if !isHome}
|
{#if !isHome}
|
||||||
{$t(`settings.page.${currentPageTitle}`)}
|
{$t(`settings.page.${currentPageTitle}`)}
|
||||||
{:else}
|
{:else}
|
||||||
|
@ -149,7 +155,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if !isMobile || !isHome}
|
{#if !isMobile || !isHome}
|
||||||
<main id="settings-page-content">
|
<main id="settings-page-content" data-first-focus tabindex="-1">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</main>
|
</main>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
Loading…
Reference in a new issue