Skip to content
Closed
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
10 changes: 7 additions & 3 deletions frontend/src/components/ResponsiveButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Button } from "./ui/button";
import { buttonVariants } from "./ui/buttonVariants";

type Props = {
icon: React.ComponentType;
icon: React.ComponentType<{ className?: string }>;
text: string;
} & React.ComponentProps<"button"> &
VariantProps<typeof buttonVariants> & {
Expand All @@ -19,11 +19,12 @@ const ResponsiveButton = ({
asChild,
children,
className,
disabled,
...props
}: Props) => {
const content = (
<>
<Icon />
<Icon aria-hidden="true" />
<span className="hidden lg:inline">{text}</span>
</>
);
Expand All @@ -33,9 +34,12 @@ const ResponsiveButton = ({
{...props}
variant={variant}
asChild={asChild}
disabled={disabled}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should add these additional props - they should be handled by shadcn (our component is just a wrapper for a shadcn button).

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the clarification, that makes sense 👍

I agree that accessibility semantics should live in the underlying shadcn Button rather than being duplicated in a wrapper component. Since ResponsiveButton is intentionally thin, adding extra props here could introduce inconsistencies over time.

I’m happy to:

revert the additional accessibility props in this PR, or

alternatively explore improvements directly in the shadcn button usage/config if that’s preferred.

Let me know which direction you’d like — thanks for the guidance.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi, yes any accessibility improvements that should be fixed inside the shadcn UI directly, it would be better to do a PR there, not here

Copy link
Author

Choose a reason for hiding this comment

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

Hi, yes any accessibility improvements that should be fixed inside the shadcn UI directly, it would be better to do a PR there, not here

Thanks for the clarification — that makes sense.

Since ResponsiveButton is intentionally a thin wrapper around shadcn, I agree accessibility semantics should live in the underlying shadcn Button rather than being reimplemented here.

I’ll close this PR and follow up with accessibility improvements at the correct layer if helpful.

Appreciate the guidance

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds great, thank you!

aria-disabled={disabled}
aria-label={text}
className={cn(
className,
"max-lg:size-9" /* apply size="icon" only for mobile */
"max-lg:size-9" /* apply size=\"icon\" only for mobile */
)}
>
{asChild
Expand Down