Skip to content

Commit

Permalink
fix: add accessibility label on buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanRoger committed Jan 10, 2024
1 parent 104daaa commit a92fff0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/components/Footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import SponsorButton from "./SponsorButton.astro";
class="tooltip tooltip-top flex items-center"
data-tip="Fork me"
>
<IconButton name="fork" height="17" width="17" />
<IconButton name="fork" height="17" width="17" alt="Goto to Github" />
</a>
<a href="/rss.xml" class="tooltip tooltip-top flex items-center" data-tip="RSS">
<IconButton name="rss" height="17" width="17" />
<IconButton name="rss" height="17" width="17" alt="Check RSS page" />
</a>
<SponsorButton/>
</aside>
Expand Down
7 changes: 4 additions & 3 deletions src/components/IconButton.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ interface Props {
name: string,
width: string,
height?: string
alt: string
}
const props = Astro.props
const { name, width, height, alt } = Astro.props
---

<button class="transition hover:scale-110 focus:ring-2">
<Icon name={props.name} width={props.width} height={props.height}/>
<button class="transition hover:scale-110 focus:ring-2" aria-label={alt}>
<Icon name={name} width={width} height={height}/>
</button>
4 changes: 2 additions & 2 deletions src/components/PostSideBarLeft.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import IconButton from "./IconButton.astro";
<aside class="flex flex-row gap-6 items-center">
<span class="font-bold text-xs">SHARE</span>
<span id="copyLink">
<IconButton name="link" width="30" height="30"/>
<IconButton name="link" width="30" height="30" alt="Copy link" />
</span>
<span id="shareTwitter">
<IconButton name="twitter" width="30" height="30"/>
<IconButton name="twitter" width="30" height="30" alt="Share on Twitter (X)"/>
</span>
<!-- <button id="shareLinkedin" class="transition hover:scale-110">
<Icon name="linkedin" width="30" height="30"/>
Expand Down
3 changes: 1 addition & 2 deletions src/components/ToggleLightDark.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import { Icon } from 'astro-icon'
---

<button id="toggle-theme" class="swap swap-rotate">
<input type="checkbox"/>
<button id="toggle-theme" class="swap swap-rotate" aria-label="Toggle light/dark mode">
<span id="toggle-icon-sun" class="swap-on">
<Icon name="sun" width="30" height="30" />
</span>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/about.astro
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ const linkedinUrl = adm.linkedin;
</div>
<div class="flex flex-row gap-3">
<social-button data-url={githubUrl}>
<IconButton name="github" width="30" height="30" />
<IconButton name="github" width="30" height="30" alt="Goto creator's GitHub" />
</social-button>
<social-button data-url={linkedinUrl}>
<IconButton name="linkedin" width="30" height="30" />
<IconButton name="linkedin" width="30" height="30" alt="Goto creator's Linkedin" />
</social-button>
</div>
<div>
Expand Down

0 comments on commit a92fff0

Please sign in to comment.