diff --git a/ui/src/components/InlineEntitySelector.tsx b/ui/src/components/InlineEntitySelector.tsx index ca2c5402..0c274b56 100644 --- a/ui/src/components/InlineEntitySelector.tsx +++ b/ui/src/components/InlineEntitySelector.tsx @@ -106,11 +106,18 @@ export const InlineEntitySelector = forwardRef { event.preventDefault(); - inputRef.current?.focus(); + // On touch devices, don't auto-focus the search input to avoid + // opening the virtual keyboard which reshapes the viewport and + // pushes the popover off-screen. + const isTouch = window.matchMedia("(pointer: coarse)").matches; + if (!isTouch) { + inputRef.current?.focus(); + } }} onCloseAutoFocus={(event) => { if (!shouldPreventCloseAutoFocusRef.current) return; @@ -170,7 +177,7 @@ export const InlineEntitySelector = forwardRef setHighlightedIndex(index)}