Skip to content

Commit 3c0a7d9

Browse files
authored
πŸ”€ Merge pull request #11 from clean-css/feature/a11n
Improve a11n
2 parents 3c8a6db + c8ce97b commit 3c0a7d9

10 files changed

+67
-9
lines changed

β€Žpackage.json

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"sirv-cli": "^1.0.12",
2222
"svelte": "^3.0.0",
2323
"svelte-bootstrap-icons": "1.5.0",
24+
"svelte-emoji": "^1.0.2",
2425
"svelte-file-dropzone": "^0.0.15",
2526
"svelte-loader": "^3.1.2",
2627
"util": "^0.12.4",

β€Žsrc/App.svelte

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script>
2+
import GoToMainContent from './components/GoToMainContent.svelte'
23
import Navbar from './components/Navbar.svelte'
34
import Header from './components/Header.svelte'
45
import Footer from './components/Footer.svelte'
@@ -7,9 +8,10 @@
78
import Textarea from './components/Textarea.svelte'
89
</script>
910

11+
<GoToMainContent />
1012
<Navbar />
1113
<Header />
12-
<main class="d-flex flex-column justify-content-center align-items-center px-2 px-sm-5">
14+
<main id="mainContent" class="d-flex flex-column justify-content-center align-items-center px-2 px-sm-5">
1315
<Settings />
1416
<Textarea />
1517
<FileDropzone />

β€Žsrc/components/CopySaveActions.svelte

+15-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
export let onSave
99
1010
const VALIDATION_ANIMATION_DURATION = 700
11+
const DOWNLOAD_MINIFIED_CSS = 'Download minified css'
12+
const COPY_MINIFIED_CSS = 'Copy minified css to clipboard'
13+
1114
let isSavedToClipboard = false
1215
let isSaved = false
1316
@@ -31,10 +34,20 @@
3134
</script>
3235

3336
<div class={`d-flex ${className} copy-save-actions`}>
34-
<button class="btn btn-link p-1" on:click={saveToClipboard}>
37+
<button
38+
class="btn btn-link p-1"
39+
title={COPY_MINIFIED_CSS}
40+
aria-label={COPY_MINIFIED_CSS}
41+
on:click={saveToClipboard}
42+
>
3543
<Icon name={isSavedToClipboard ? 'check' : 'clipboard'}/>
3644
</button>
37-
<button class="btn btn-link p-1 ms-1" on:click={save}>
45+
<button
46+
class="btn btn-link p-1 ms-1"
47+
title={DOWNLOAD_MINIFIED_CSS}
48+
aria-label={DOWNLOAD_MINIFIED_CSS}
49+
on:click={save}
50+
>
3851
<Icon name={isSaved ? 'check' : 'download'}/>
3952
</button>
4053
</div>

β€Žsrc/components/Footer.svelte

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
<script>
2+
import Emoji from 'svelte-emoji'
3+
</script>
4+
15
<footer class="text-center mt-5 mb-2">
2-
Hosted with <span>❀️&nbsp;</span> on <a href="//pages.github.com/">GitHub Pages</a>.
6+
Hosted with <Emoji symbol="❀️ " label="love" /> on <a href="//pages.github.com/">GitHub Pages</a>.
37
</footer>
48

59
<style>
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<a
2+
href="#mainContent"
3+
class="position-absolute top-0 start-0 btn btn-outline-secondary bg-light text-primary m-2 visually-hidden-focusable"
4+
>
5+
Go to main content
6+
</a>
7+
8+
<style>
9+
a {
10+
z-index: 5;
11+
}
12+
</style>

β€Žsrc/components/Icon/Icon.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
}
3636
</style>
3737

38-
<img src={icons[name]} class={`icon ${className}`} alt={`Icon ${name}`} />
38+
<img src={icons[name]} class={`icon ${className}`} alt="" />

β€Žsrc/components/SavedSizeBadge.svelte

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@
44
export { className as class }
55
</script>
66

7-
<span class={`fw-lighter fst-italic ${className}`}> - saved {size / 1000} kB</span>
7+
<span
8+
class={`fw-lighter fst-italic ${className}`}
9+
aria-live="polite"
10+
>
11+
- saved {size / 1000} kB
12+
</span>

β€Žsrc/components/Settings.svelte

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111

1212
<div class="settings">
1313
<div class="d-flex justify-content-end">
14-
<button class="btn mb-2" on:click={toggleOpen}>
14+
<button class="btn btn-outline-secondary mb-2 d-flex bg-light text-dark" on:click={toggleOpen}>
1515
<Icon name={open ? 'gear-highlighted' : 'gear'}/>
16+
<p class="m-0 ms-1">Settings</p>
1617
</button>
1718
</div>
1819

β€Žsrc/components/Textarea.svelte

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script>
22
import { saveAs } from 'file-saver'
33
import * as CleanCSS from 'clean-css'
4+
import Emoji from 'svelte-emoji'
5+
46
import CopySaveActions from './CopySaveActions.svelte'
57
import SavedSizeBadge from './SavedSizeBadge.svelte'
68
@@ -34,10 +36,23 @@
3436

3537
<textarea bind:value={input} class="form-control" rows="6" placeholder="enter your raw css here to optimize it..."></textarea>
3638
<div class="row mt-2">
37-
<button class="btn btn-primary d-inline" style="background-color: #27AAE1;" on:click={optimize}>optimize ➜</button>
39+
<button
40+
class="btn btn-primary d-inline"
41+
style="background-color: #27AAE1;"
42+
on:click={optimize}
43+
>
44+
optimize
45+
<Emoji symbol="➜" />
46+
</button>
3847

3948
<div id="result" class="position-relative ms-2 flex-grow-1 d-flex p-0 align-items-center" style="width: 0;">
40-
<input class="form-control" type="text" disabled={optimizedInput === undefined} bind:value={optimizedInput}>
49+
<input
50+
type="text"
51+
class="form-control"
52+
aria-hidden={true}
53+
disabled={optimizedInput === undefined}
54+
bind:value={optimizedInput}
55+
>
4156
{#if optimizedInput !== undefined}
4257
<SavedSizeBadge size={savedSize} class="text-nowrap ms-2" />
4358
<CopySaveActions

β€Žyarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -3730,6 +3730,11 @@ svelte-dev-helper@^1.1.9:
37303730
resolved "https://registry.yarnpkg.com/svelte-dev-helper/-/svelte-dev-helper-1.1.9.tgz#7d187db5c6cdbbd64d75a32f91b8998bde3273c3"
37313731
integrity sha1-fRh9tcbNu9ZNdaMvkbiZi94yc8M=
37323732

3733+
svelte-emoji@^1.0.2:
3734+
version "1.0.2"
3735+
resolved "https://registry.yarnpkg.com/svelte-emoji/-/svelte-emoji-1.0.2.tgz#43212210bc77fcd766cc846022a98c787a2a6cbd"
3736+
integrity sha512-vJCBsgrSKZONxBn7ICZxCKzDRaJk7Bi3dALwa3PrIiPS8DP8Fw64N38EuuY90eKNuLmOm4DLNRM+hSeH0V2G5g==
3737+
37333738
svelte-file-dropzone@^0.0.15:
37343739
version "0.0.15"
37353740
resolved "https://registry.yarnpkg.com/svelte-file-dropzone/-/svelte-file-dropzone-0.0.15.tgz#6145fbafc448ea47ec803303641246efdb31cae6"

0 commit comments

Comments
Β (0)