Skip to content
Open
Changes from 1 commit
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
16 changes: 13 additions & 3 deletions src/components/Nav/MainNavLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,31 @@ export const MainNavLinks = ({
<ul>
{links.map((link) => (
<li key={link.label}>
<a href={link.url}>{link.label}</a>
<a href={link.url} tabIndex={isOpen ? 0 : -1}>
Copy link
Collaborator

@coseeian coseeian Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: since <a> elements are naturally focusable, we only need tabIndex when hiding them. Consider using tabIndex={isOpen ? undefined : -1} instead of the ternary with 0, which avoids redundant attributes in DOM.

This would apply to all three link groups (nav links on L78, editor button on L89, and donate button on L101).

{link.label}
</a>
</li>
))}
</ul>
<ul class="flex flex-col gap-[15px]">
<li>
<a className={styles.buttonlink} href="https://editor.p5js.org">
<a
className={styles.buttonlink}
href="https://editor.p5js.org"
tabIndex={isOpen ? 0 : -1}
>
<div class="mr-xxs">
<Icon kind="code-brackets" />
</div>
{editorButtonLabel}
</a>
</li>
<li>
<a className={styles.buttonlink} href="/donate/">
<a
className={styles.buttonlink}
href="/donate/"
tabIndex={isOpen ? 0 : -1}
>
<div class="mr-xxs">
<Icon kind="heart" />
</div>
Expand Down