Skip to content

Aria labels 2.0 #911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Banner/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { link, title } = entry.data;
<a class="banner-content" href={link} target="_blank">
<Content />
</a>
<button id="hideBanner"><Icon kind="close"></button>
<button id="hideBanner" aria-label="Hide banner"><Icon kind="close" /></button>
</div>

<script>
Expand Down
5 changes: 3 additions & 2 deletions src/components/Nav/JumpToLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ export const JumpToLinks = ({
<button
class={styles.toggle}
onClick={handleToggle}
aria-hidden="true"
tabIndex={-1}
aria-expanded={isOpen}
aria-label={`${heading} menu toggle`}
>
<span>{heading}</span>
<div class="pt-[6px]">
<Icon kind={isOpen ? "chevron-down" : "chevron-up"} />
</div>
</button>

{isOpen && (
<ul>
{links?.map((link) => (
Expand Down
42 changes: 20 additions & 22 deletions src/components/Nav/MainNavLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export const MainNavLinks = ({
<button
class={styles.toggle}
onClick={handleToggle}
aria-hidden="true"
tabIndex={-1}
aria-expanded={isOpen}
aria-label={mobileMenuLabel || "Toggle navigation menu"}
>
<div class={styles.mobileMenuLabel}>
{isOpen ? (
Expand Down Expand Up @@ -79,26 +79,24 @@ export const MainNavLinks = ({
</li>
))}
</ul>
{
<ul class="flex flex-col gap-[15px]">
<li>
<a className={styles.buttonlink} href="https://editor.p5js.org">
<div class="mr-xxs">
<Icon kind="code-brackets" />
</div>
{editorButtonLabel}
</a>
</li>
<li>
<a className={styles.buttonlink} href="/donate/">
<div class="mr-xxs">
<Icon kind="heart" />
</div>
{donateButtonLabel}
</a>
</li>
</ul>
}
<ul class="flex flex-col gap-[15px]">
<li>
<a className={styles.buttonlink} href="https://editor.p5js.org">
<div class="mr-xxs">
<Icon kind="code-brackets" />
</div>
{editorButtonLabel}
</a>
</li>
<li>
<a className={styles.buttonlink} href="/donate/">
<div class="mr-xxs">
<Icon kind="heart" />
</div>
{donateButtonLabel}
</a>
</li>
</ul>
</div>
);
};
7 changes: 4 additions & 3 deletions src/components/ReferenceDirectoryWithFilter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,10 @@ export const ReferenceDirectoryWithFilter = ({
}}
/>
{searchKeyword.length > 0 && (
<button type="reset" class="" onClick={clearInput}>
<Icon kind="close" className="h-4 w-4" />
</button>
<button type="reset" class="" onClick={clearInput} aria-label="Clear search input">
<Icon kind="close" className="h-4 w-4" />
</button>

)}
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/components/SearchResults/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ const SearchResults = ({
value={category}
className="capitalize"
onClick={() => toggleFilter(category)}
aria-pressed={currentFilter === category}
aria-label={`Filter by ${uiTranslations[uiTranslationKey(category)]}`}
>
<div class="flex flex-nowrap gap-xs">
{uiTranslations[uiTranslationKey(category)]}
Expand Down Expand Up @@ -131,6 +133,7 @@ const SearchResults = ({
type="submit"
class="absolute right-0 top-[2px] px-[22px] py-[13px]"
onClick={submitInput}
aria-label="Submit search"
>
<Icon kind="arrow-lg" />
</button>
Expand All @@ -139,6 +142,7 @@ const SearchResults = ({
type="reset"
class="absolute right-0 top-0 px-[22px] py-[13px]"
onClick={clearInput}
aria-label="Clear search input"
>
<Icon kind="close-lg" />
</button>
Expand Down