-
-
Notifications
You must be signed in to change notification settings - Fork 536
Feat/add aria labels #2871
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
Feat/add aria labels #2871
Changes from all commits
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 |
|---|---|---|
|
|
@@ -42,6 +42,7 @@ export default function NavDropdown({ link, pathname }: NavDropDownProps) { | |
| <button | ||
| className="flex cursor-pointer items-center gap-2 whitespace-nowrap" | ||
| onClick={() => setIsOpen((prev) => !prev)} | ||
| aria-label={`${link.text} menu`} | ||
| aria-expanded={isOpen} | ||
| aria-haspopup="true" | ||
| aria-controls={dropdownId} | ||
|
|
@@ -65,13 +66,15 @@ export default function NavDropdown({ link, pathname }: NavDropDownProps) { | |
| </button> | ||
| {isOpen && ( | ||
| <div | ||
| role="menu" | ||
|
||
| id={dropdownId} | ||
| className="absolute top-full left-0 z-10 mt-1 w-48 overflow-hidden rounded-md bg-white shadow-lg dark:bg-slate-800" | ||
| > | ||
| {link.submenu.map((submenu, idx) => ( | ||
| <Link | ||
| key={`${submenu.href}-${idx}`} | ||
| href={submenu.href || '/'} | ||
| aria-current={pathname === submenu.href ? 'page' : undefined} | ||
| className={cn( | ||
| 'block w-full px-4 py-2 text-left text-sm transition-colors', | ||
| pathname === submenu.href | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -58,7 +58,7 @@ const Pagination: React.FC<PaginationProps> = ({ | |||||
| if (!isLoaded || totalPages <= 1) return null | ||||||
|
|
||||||
| return ( | ||||||
| <div className="mt-8 flex flex-col items-center justify-center gap-3"> | ||||||
| <nav className="mt-8 flex flex-col items-center justify-center gap-3" aria-label="Pagination"> | ||||||
| <div className="flex flex-wrap items-center justify-center gap-2"> | ||||||
| <Button | ||||||
| type="button" | ||||||
|
|
@@ -74,10 +74,9 @@ const Pagination: React.FC<PaginationProps> = ({ | |||||
| {number === '...' ? ( | ||||||
| <span | ||||||
| className="flex h-10 w-10 items-center justify-center text-gray-600 dark:text-gray-400" | ||||||
| role="presentation" | ||||||
| aria-label="More pages" | ||||||
|
||||||
| aria-label="More pages" | |
| aria-hidden="true" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -68,30 +68,34 @@ const SearchBar: React.FC<SearchProps> = ({ | |||||
| } | ||||||
|
|
||||||
| return ( | ||||||
| <div className="w-full max-w-md p-4"> | ||||||
| <div className="w-full max-w-md p-4" role="search"> | ||||||
| <div className="relative"> | ||||||
| {!isLoaded ? ( | ||||||
| <> | ||||||
| <FontAwesomeIcon | ||||||
| icon={faSearch} | ||||||
| className="pointer-events-none absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 text-gray-400" | ||||||
| aria-hidden="true" | ||||||
| /> | ||||||
| <input | ||||||
| ref={inputRef} | ||||||
| type="text" | ||||||
|
||||||
| type="text" | |
| type="search" |
Copilot
AI
Dec 11, 2025
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.
The aria-label should start with a capital letter and be more descriptive to match the standard pattern. Consider using "Search" instead of "search" for consistency with other ARIA labels in the codebase.
| aria-label="search" | |
| aria-label="Search" |
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.
The aria-haspopup value should be "menu" to match the role="menu" on the dropdown container. Currently it's set to "true" which is equivalent to "menu", but using the explicit string value improves clarity and follows ARIA best practices.