Skip to content
Open
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
45 changes: 27 additions & 18 deletions src/components/atoms/Filter/Filter.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import * as React from 'react';
import { Check } from 'lucide-react';
import { cn } from '@/libs/utils/utils';
import { Button } from '../Button/Button';
import { Container } from '../Container/Container';
Expand Down Expand Up @@ -71,26 +72,34 @@ function FilterItem({
children: React.ReactNode;
} & React.ButtonHTMLAttributes<HTMLButtonElement>) {
return (
<Button
type="button"
data-slot="filter-item"
data-testid="filter-item"
data-selected={isSelected ? 'true' : 'false'}
aria-pressed={isSelected}
<Container
overrideDefaults
className={cn(
'flex cursor-pointer gap-2 text-base font-medium transition-colors',
'border-0 bg-transparent p-0 text-left',
'items-center justify-normal',
isSelected ? 'text-foreground' : 'text-muted-foreground hover:text-foreground/80',
'm-0 h-full px-0 py-1',
className,
)}
onClick={onClick}
{...props}
data-slot="filter-item-container"
data-testid="filter-item-container"
className="flex items-center justify-between"
>
{children}
</Button>
<Button
type="button"
data-slot="filter-item"
data-testid="filter-item"
data-selected={isSelected ? 'true' : 'false'}
aria-pressed={isSelected}
overrideDefaults
className={cn(
'flex cursor-pointer gap-2 text-base font-medium transition-colors',
'border-0 bg-transparent p-0 text-left',
'items-center justify-normal',
isSelected ? 'text-foreground' : 'text-muted-foreground hover:text-foreground/80',
'm-0 h-full px-0 py-1',
className,
)}
onClick={onClick}
{...props}
>
{children}
</Button>
{isSelected && <Check className="lg:hidden"></Check>}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Check sits outside click target

When a mobile or tablet user taps the visible check icon or the space beside it, the outer container receives the interaction while onClick remains attached only to the sibling button, causing that part of the selected filter row to do nothing.

</Container>
);
}

Expand Down