Skip to content

Commit 3bf2f15

Browse files
committed
♿️ Improve accessibility of components
1 parent 090fedf commit 3bf2f15

File tree

11 files changed

+14
-3
lines changed

11 files changed

+14
-3
lines changed

src/components/Banner/Banner.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const style = top
3939
theme="flat"
4040
className={styles.close}
4141
data-id="w-banner-close"
42+
aria-label="close"
4243
>
4344
<Fragment set:html={closeIcon} />
4445
</Button>

src/components/Banner/Banner.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
theme="flat"
4343
className={styles.close}
4444
onClick={() => visible = false}
45+
aria-label="close"
4546
>
4647
{@html closeIcon}
4748
</Button>

src/components/Banner/Banner.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const Banner = ({
4545
className={styles.close}
4646
dangerouslySetInnerHTML={{ __html: closeIcon }}
4747
onClick={() => setVisible(false)}
48+
aria-label="close"
4849
/>
4950
)}
5051
</div>

src/components/Copy/Copy.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const classes = classNames([
3838
<button
3939
class={styles['copy-icon']}
4040
data-id="w-copy"
41+
aria-label="copy"
4142
>
4243
{copyIcon?.startsWith('<svg')
4344
? <Fragment set:html={copyIcon} />

src/components/Copy/Copy.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@
5454
<span data-id="text">{@render children?.()}</span>
5555
<div class={styles.icons}>
5656
<button
57-
class={styles['copy-icon']}
5857
bind:this={copyButton}
58+
class={styles['copy-icon']}
5959
onclick={copyText}
60+
aria-label="copy"
6061
>
6162
{@html copyIcon || copy}
6263
</button>

src/components/Copy/Copy.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const Copy = ({
5858
className={styles['copy-icon']}
5959
ref={copyButton}
6060
onClick={copyText}
61+
aria-label="copy"
6162
dangerouslySetInnerHTML={{ __html: copyIcon || copy }}
6263
/>
6364
<span

src/components/Modal/Modal.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const classes = [
5858
theme="flat"
5959
className={styles.close}
6060
data-id="close"
61+
aria-label="close"
6162
>
6263
<Fragment set:html={closeIcon} />
6364
</Button>

src/components/Modal/Modal.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
theme="flat"
6060
className={styles.close}
6161
data-id="close"
62+
aria-label="close"
6263
>
6364
{@html closeIcon}
6465
</Button>

src/components/Modal/Modal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ const Modal = ({
5858
<Button
5959
theme="flat"
6060
className={styles.close}
61-
data-id="close"
6261
dangerouslySetInnerHTML={{ __html: closeIcon }}
62+
data-id="close"
63+
aria-label="close"
6364
/>
6465
)}
6566
{title && (

src/components/Pagination/Pagination.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,12 @@ const generatedPages = pages?.length
5858
>
5959
{type === 'dots' ? (
6060
<Fragment>
61-
{generatedPages?.map(page => (
61+
{generatedPages?.map((page, index) => (
6262
<li>
6363
<button
6464
data-active={page.active ? 'true' : undefined}
6565
data-page={page.label}
66+
aria-label={`page ${index + 1}`}
6667
/>
6768
</li>
6869
))}

src/components/Pagination/Pagination.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ const Pagination = ({
8888
{generatedPages?.map((_, index) => (
8989
<li key={index}>
9090
<button
91+
aria-label={`page ${index + 1}`}
9192
data-active={calculatedCurrentPage === index + 1 ? 'true' : null}
9293
onClick={calculatedCurrentPage !== index + 1
9394
? () => paginate(index + 1)

0 commit comments

Comments
 (0)