Skip to content

Commit

Permalink
♿️ Improve accessibility of components
Browse files Browse the repository at this point in the history
  • Loading branch information
Frontendland committed Jan 17, 2025
1 parent 090fedf commit 3bf2f15
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/Banner/Banner.astro
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const style = top
theme="flat"
className={styles.close}
data-id="w-banner-close"
aria-label="close"
>
<Fragment set:html={closeIcon} />
</Button>
Expand Down
1 change: 1 addition & 0 deletions src/components/Banner/Banner.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
theme="flat"
className={styles.close}
onClick={() => visible = false}
aria-label="close"
>
{@html closeIcon}
</Button>
Expand Down
1 change: 1 addition & 0 deletions src/components/Banner/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const Banner = ({
className={styles.close}
dangerouslySetInnerHTML={{ __html: closeIcon }}
onClick={() => setVisible(false)}
aria-label="close"
/>
)}
</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/Copy/Copy.astro
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const classes = classNames([
<button
class={styles['copy-icon']}
data-id="w-copy"
aria-label="copy"
>
{copyIcon?.startsWith('<svg')
? <Fragment set:html={copyIcon} />
Expand Down
3 changes: 2 additions & 1 deletion src/components/Copy/Copy.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@
<span data-id="text">{@render children?.()}</span>
<div class={styles.icons}>
<button
class={styles['copy-icon']}
bind:this={copyButton}
class={styles['copy-icon']}
onclick={copyText}
aria-label="copy"
>
{@html copyIcon || copy}
</button>
Expand Down
1 change: 1 addition & 0 deletions src/components/Copy/Copy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const Copy = ({
className={styles['copy-icon']}
ref={copyButton}
onClick={copyText}
aria-label="copy"
dangerouslySetInnerHTML={{ __html: copyIcon || copy }}
/>
<span
Expand Down
1 change: 1 addition & 0 deletions src/components/Modal/Modal.astro
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const classes = [
theme="flat"
className={styles.close}
data-id="close"
aria-label="close"
>
<Fragment set:html={closeIcon} />
</Button>
Expand Down
1 change: 1 addition & 0 deletions src/components/Modal/Modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
theme="flat"
className={styles.close}
data-id="close"
aria-label="close"
>
{@html closeIcon}
</Button>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ const Modal = ({
<Button
theme="flat"
className={styles.close}
data-id="close"
dangerouslySetInnerHTML={{ __html: closeIcon }}
data-id="close"
aria-label="close"
/>
)}
{title && (
Expand Down
3 changes: 2 additions & 1 deletion src/components/Pagination/Pagination.astro
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ const generatedPages = pages?.length
>
{type === 'dots' ? (
<Fragment>
{generatedPages?.map(page => (
{generatedPages?.map((page, index) => (
<li>
<button
data-active={page.active ? 'true' : undefined}
data-page={page.label}
aria-label={`page ${index + 1}`}
/>
</li>
))}
Expand Down
1 change: 1 addition & 0 deletions src/components/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const Pagination = ({
{generatedPages?.map((_, index) => (
<li key={index}>
<button
aria-label={`page ${index + 1}`}
data-active={calculatedCurrentPage === index + 1 ? 'true' : null}
onClick={calculatedCurrentPage !== index + 1
? () => paginate(index + 1)
Expand Down

0 comments on commit 3bf2f15

Please sign in to comment.