From a8a3b4cfd9e7adfb261db7c2f8fdff12f10c6af5 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Wed, 4 Sep 2024 09:39:41 +1000 Subject: [PATCH] Don't focus query field on select (#5204) --- ui/v2.5/src/components/List/Filters/SelectableFilter.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/v2.5/src/components/List/Filters/SelectableFilter.tsx b/ui/v2.5/src/components/List/Filters/SelectableFilter.tsx index 42b37aae3ab..19d2b70bbf1 100644 --- a/ui/v2.5/src/components/List/Filters/SelectableFilter.tsx +++ b/ui/v2.5/src/components/List/Filters/SelectableFilter.tsx @@ -24,6 +24,7 @@ import { CriterionModifier } from "src/core/generated-graphql"; import { keyboardClickHandler } from "src/utils/keyboard"; import { useDebounce } from "src/hooks/debounce"; import useFocus from "src/utils/focus"; +import ScreenUtils from "src/utils/screen"; interface ISelectedItem { item: ILabeledId; @@ -235,7 +236,10 @@ export const ObjectsFilter = < setDisplayQuery(""); // focus the input box - setInputFocus(); + // don't do this on touch devices, as it's annoying + if (!ScreenUtils.isTouch()) { + setInputFocus(); + } } const onUnselect = useCallback(