Skip to content

Commit

Permalink
fix(a11y): add selected state to season filters
Browse files Browse the repository at this point in the history
  • Loading branch information
royschut committed Feb 28, 2024
1 parent f4d3e01 commit 954d40f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/ui-react/src/components/Filter/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ const Filter: FC<Props> = ({ name, value, defaultLabel, options, setValue, force
{options.map((option) => {
const optionLabel = typeof option === 'string' ? option : option.label;
const optionValue = typeof option === 'string' ? option : option.value;
const active = value === optionValue;

return <Button label={optionLabel} onClick={() => setValue(optionValue)} key={optionValue} active={value === optionValue} role="option" />;
return <Button label={optionLabel} onClick={() => setValue(optionValue)} key={optionValue} active={active} role="option" aria-selected={active} />;
})}
<Button label={defaultLabel} onClick={() => setValue('')} active={value === ''} key={defaultLabel} role="option" />
<Button label={defaultLabel} onClick={() => setValue('')} active={value === ''} key={defaultLabel} role="option" aria-selected={value === ''} />
</div>
) : (
<div className={styles.filterDropDown}>
Expand Down

0 comments on commit 954d40f

Please sign in to comment.