Skip to content

Commit

Permalink
work on 710
Browse files Browse the repository at this point in the history
  • Loading branch information
barbalex committed Jan 24, 2025
1 parent e5a0be6 commit 2749962
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/shared/FormTitle/FilterInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ const StyledTextField = styled(TextField)`
}
`

const isCoarsePointer = matchMedia('(pointer: coarse)').matches

export const FilterInput = memo(
observer(({ filterInputIsVisible, ref: inputRef }) => {
const store = useContext(MobxContext)
Expand Down Expand Up @@ -80,11 +78,12 @@ export const FilterInput = memo(
setValue(val)

// on coarse pointer filter on enter, not debounced
const isCoarsePointer = matchMedia('(pointer: coarse)').matches
if (isCoarsePointer) return

setNodeLabelFilterDebounced(val)
},
[setNodeLabelFilterDebounced, isCoarsePointer],
[setNodeLabelFilterDebounced],
)

// issue: (https://github.com/barbalex/apf2/issues/710)
Expand All @@ -93,12 +92,13 @@ export const FilterInput = memo(
// thus better to filter on pressing enter
const onKeyDown = useCallback(
(e) => {
const isCoarsePointer = matchMedia('(pointer: coarse)').matches
if (!isCoarsePointer) return
if (!e.key === 'Enter') return

setNodeLabelFilter(value)
},
[setNodeLabelFilter, isCoarsePointer, value],
[setNodeLabelFilter, value],
)

const onClickEmpty = useCallback(() => {
Expand Down

0 comments on commit 2749962

Please sign in to comment.