-
Notifications
You must be signed in to change notification settings - Fork 193
fix: prevent menu links from being focusable when menu is closed #986
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
base: main
Are you sure you want to change the base?
Changes from 6 commits
b0327d9
3eb4b39
e1f9341
2c75fd8
6b3dd81
adb8ff5
fd545a3
44e6cfc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,7 @@ export const MainNavLinks = ({ | |
| class={styles.toggle} | ||
| onClick={handleToggle} | ||
| aria-expanded={isOpen} | ||
| aria-controls="main-links-list main-cta-list" | ||
| aria-label={mobileMenuLabel || "Toggle navigation menu"} | ||
| > | ||
| <div class={styles.mobileMenuLabel}> | ||
|
|
@@ -72,24 +73,34 @@ export const MainNavLinks = ({ | |
| }`} | ||
| > | ||
| {renderLogo()} | ||
| <ul> | ||
| <ul id="main-links-list" hidden={!isOpen}> | ||
| {links.map((link) => ( | ||
| <li key={link.label}> | ||
| <a href={link.url}>{link.label}</a> | ||
| <a href={link.url} tabIndex={isOpen ? undefined : -1}> | ||
| {link.label} | ||
| </a> | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| <ul class="flex flex-col gap-[15px]"> | ||
| <ul id="main-cta-list" class="flex flex-col gap-[15px]" hidden={!isOpen}> | ||
|
||
| <li> | ||
| <a className={styles.buttonlink} href="https://editor.p5js.org"> | ||
| <a | ||
| className={styles.buttonlink} | ||
| href="https://editor.p5js.org" | ||
| tabIndex={isOpen ? undefined : -1} | ||
| > | ||
| <div class="mr-xxs"> | ||
hxrshxz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <Icon kind="code-brackets" /> | ||
| </div> | ||
| {editorButtonLabel} | ||
| </a> | ||
| </li> | ||
| <li> | ||
| <a className={styles.buttonlink} href="/donate/"> | ||
| <a | ||
| className={styles.buttonlink} | ||
| href="/donate/" | ||
| tabIndex={isOpen ? undefined : -1} | ||
| > | ||
| <div class="mr-xxs"> | ||
hxrshxz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <Icon kind="heart" /> | ||
| </div> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simplify this. Because
hiddennormally handles focus prevention, we can omit thetabIndexmanipulation on each link.