Skip to content

Commit f384277

Browse files
Rich-HarrisRich Harris
and
Rich Harris
authored
Fix some Lighthouse stuff (sveltejs#357)
* only apply aria-label to links with hrefs * add some manifest junk * bigger tap targets * add description --------- Co-authored-by: Rich Harris <[email protected]>
1 parent 6d03557 commit f384277

File tree

6 files changed

+38
-2
lines changed

6 files changed

+38
-2
lines changed

src/app.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
77
<meta name="color-scheme" content="dark light" />
8+
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#fff" />
9+
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#2e2e2e" />
10+
<meta name="description" content="Learn Svelte and SvelteKit with an interactive browser-based tutorial" />
11+
<link rel="manifest" href="/manifest.json" />
812
%sveltekit.head%
913
</head>
1014
<body data-sveltekit-preload-data="hover">

src/routes/tutorial/[slug]/Chrome.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
}}
2626
/>
2727

28-
<a {href} class="new-tab icon" target="_blank" aria-label="open in new tab" tabindex="0" />
28+
<a {href} class="new-tab icon" target="_blank" aria-label={href ? 'open in new tab' : undefined} tabindex="0" />
2929

3030
<button
3131
disabled={loading}

src/routes/tutorial/[slug]/Menu.svelte

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
</div>
157157

158158
<header>
159-
<a href={current.prev ? `/tutorial/${current.prev.slug}` : undefined} aria-label="Previous">
159+
<a href={current.prev ? `/tutorial/${current.prev.slug}` : undefined} aria-label={current.prev && 'Previous'}>
160160
<Icon name="arrow-left" size={16} />
161161
</a>
162162

@@ -351,6 +351,14 @@
351351
box-sizing: border-box;
352352
}
353353
354+
header a {
355+
height: 100%;
356+
display: flex;
357+
align-items: center;
358+
justify-content: center;
359+
padding: 0 1rem;
360+
}
361+
354362
a:focus-visible,
355363
.exercises button:focus-visible {
356364
outline: none;

static/manifest.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"short_name": "Learn Svelte",
3+
"name": "learn.svelte.dev",
4+
"description": "An interactive Svelte/SvelteKit tutorial",
5+
"icons": [
6+
{
7+
"src": "/svelte-logo-square.svg",
8+
"type": "image/svg+xml",
9+
"sizes": "512x512"
10+
},
11+
{
12+
"src": "/svelte-logo-square.png",
13+
"type": "image/png",
14+
"sizes": "512x512",
15+
"purpose": "any maskable"
16+
}
17+
],
18+
"start_url": "/",
19+
"background_color": "#383838",
20+
"theme_color": "#383838",
21+
"display": "minimal-ui",
22+
"scope": "/"
23+
}

static/svelte-logo-square.png

3.96 KB
Loading

static/svelte-logo-square.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)