Skip to content

Commit ee1a4c5

Browse files
fix: make ActionButton aria-label dynamic for better accessibility
- Add ariaLabel prop to IActionButtonProps interface - Update ActionButton component to accept and use ariaLabel prop - Maintain backwards compatibility with default fallback - Fixes hardcoded "Action button" aria-label issue reported by jazzberry Co-authored-by: Anguel <modelorona@users.noreply.github.com>
1 parent dd4fefd commit ee1a4c5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

frontend/src/components/button.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ export type IActionButtonProps = {
6565
disabled?: boolean;
6666
children?: ReactNode;
6767
testId?: string;
68+
ariaLabel?: string;
6869
}
6970

70-
export const ActionButton: FC<IActionButtonProps> = ({ onClick, icon, className, containerClassName, disabled, children, testId }) => {
71+
export const ActionButton: FC<IActionButtonProps> = ({ onClick, icon, className, containerClassName, disabled, children, testId, ariaLabel }) => {
7172
return (
7273
<div className="group relative" data-testid={testId}>
7374
<motion.button
@@ -77,7 +78,7 @@ export const ActionButton: FC<IActionButtonProps> = ({ onClick, icon, className,
7778
}))}
7879
onClick={disabled ? undefined : onClick}
7980
whileTap={{ scale: 0.6, transition: { duration: 0.05 }, }}
80-
aria-label="Action button"
81+
aria-label={ariaLabel || "Action button"}
8182
disabled={disabled}>
8283
{cloneElement(icon, {
8384
className: twMerge(classNames("w-8 h-8 stroke-neutral-500 cursor-pointer dark:stroke-neutral-300", className))

0 commit comments

Comments
 (0)