fix: filter checkbox not clickable (#817)
This commit is contained in:
parent
8d3473b499
commit
66b0d7992d
@ -2,11 +2,11 @@ import React, { useCallback, useMemo } from 'react';
|
||||
import { translate } from 'react-polyglot';
|
||||
|
||||
import Menu from '../common/menu/Menu';
|
||||
import MenuItemButton from '../common/menu/MenuItemButton';
|
||||
import MenuGroup from '../common/menu/MenuGroup';
|
||||
import MenuItemButton from '../common/menu/MenuItemButton';
|
||||
|
||||
import type { FilterMap, TranslatedProps, ViewFilter } from '@staticcms/core/interface';
|
||||
import type { ChangeEvent, MouseEvent } from 'react';
|
||||
import type { MouseEvent } from 'react';
|
||||
|
||||
interface FilterControlProps {
|
||||
filter: Record<string, FilterMap>;
|
||||
@ -23,7 +23,7 @@ const FilterControl = ({
|
||||
const anyActive = useMemo(() => Object.keys(filter).some(key => filter[key]?.active), [filter]);
|
||||
|
||||
const handleFilterClick = useCallback(
|
||||
(viewFilter: ViewFilter) => (event: MouseEvent | ChangeEvent) => {
|
||||
(viewFilter: ViewFilter) => (event: MouseEvent) => {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
onFilterClick(viewFilter);
|
||||
@ -43,17 +43,15 @@ const FilterControl = ({
|
||||
return (
|
||||
<MenuItemButton key={viewFilter.id} onClick={handleFilterClick(viewFilter)}>
|
||||
<input
|
||||
key={`${labelId}-${checked}`}
|
||||
id={labelId}
|
||||
type="checkbox"
|
||||
value=""
|
||||
className=""
|
||||
checked={checked}
|
||||
onChange={handleFilterClick(viewFilter)}
|
||||
readOnly
|
||||
/>
|
||||
<label
|
||||
htmlFor={labelId}
|
||||
className="ml-2 text-sm font-medium text-gray-800 dark:text-gray-300"
|
||||
>
|
||||
<label className="ml-2 text-sm font-medium text-gray-800 dark:text-gray-300">
|
||||
{viewFilter.label}
|
||||
</label>
|
||||
</MenuItemButton>
|
||||
|
Loading…
x
Reference in New Issue
Block a user