@@ -248,15 +248,16 @@ const Combobox = memo(
248248 * which a scrollbar drag left on `<body>`. Bound to `window` so a release
249249 * outside the popover still clears the flag; `pointercancel` is included
250250 * because a touch scroll gesture ends there instead of `pointerup`.
251+ *
252+ * Focus is only restored when the press actually stole it — a press inside the
253+ * popover parks it on `<body>` or the `tabIndex={-1}` content, but option
254+ * mousedown is prevented, so it often never left the input or the search box.
251255 */
252256 useEffect ( ( ) => {
253257 if ( ! editable ) return
254258 const endPointerPress = ( ) => {
255259 if ( ! pointerDownInsideRef . current ) return
256260 pointerDownInsideRef . current = false
257- // Only restore focus if the press actually stole it: a press inside the
258- // popover parks focus on <body> or the `tabIndex={-1}` content, but option
259- // mousedown is prevented, so it often never left the input or search box.
260261 const active = document . activeElement
261262 const isTextEntry =
262263 active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement
@@ -360,7 +361,9 @@ const Combobox = memo(
360361 } , [ groups , searchable , searchQuery ] )
361362
362363 /**
363- * Handles selection of an option
364+ * Handles selection of an option. In editable mode the input is blurred on
365+ * purpose, so the pointer-press window is ended first — otherwise the `pointerup`
366+ * that follows would hand focus back and reopen the dropdown.
364367 */
365368 const handleSelect = useCallback (
366369 ( selectedValue : string , customOnSelect ?: ( ) => void , keepOpen ?: boolean ) => {
@@ -389,7 +392,6 @@ const Combobox = memo(
389392 setHighlightedIndex ( - 1 )
390393 updateSearchQuery ( '' )
391394 if ( editable && inputRef . current ) {
392- // The pointerup that follows must not hand focus back and reopen.
393395 pointerDownInsideRef . current = false
394396 inputRef . current . blur ( )
395397 }
0 commit comments