Skip to content

Commit 19da40d

Browse files
authored
feat(copy-button): add alt text for screen readers (#13)
1 parent edfbe6a commit 19da40d

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

components/ProseCodeCopyButton.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const copy = (e: MouseEvent) => {
3333

3434
<template>
3535
<button :class="[(show || state === 'copied') && 'show' ]" @click="copy">
36+
<span class="sr-only">Copy to clipboard</span>
3637
<span class="icon-wrapper">
3738
<Transition name="fade">
3839
<Icon v-if="state === 'copied'" :name="prose.copyButton?.iconCopied" size="18" class="copied" />

main.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,14 @@ html {
66
html.dark {
77
color: $dt('colors.neutral.white')
88
}
9+
.sr-only {
10+
position: absolute !important;
11+
width: 1px !important;
12+
height: 1px !important;
13+
padding: 0 !important;
14+
margin: -1px !important;
15+
overflow: hidden !important;
16+
clip: rect(0,0,0,0) !important;
17+
white-space: nowrap !important;
18+
border: 0 !important;
19+
}

0 commit comments

Comments
 (0)