@@ -20,7 +20,13 @@ import type {
2020import { useSearchClient } from './useSearchClient' ;
2121import { useTouchEvents } from './useTouchEvents' ;
2222import { useTrapFocus } from './useTrapFocus' ;
23- import { groupBy , identity , noop , removeHighlightTags } from './utils' ;
23+ import {
24+ groupBy ,
25+ identity ,
26+ noop ,
27+ removeHighlightTags ,
28+ isModifierEvent ,
29+ } from './utils' ;
2430
2531export type ModalTranslations = Partial < {
2632 searchBox : SearchBoxTranslations ;
@@ -156,7 +162,7 @@ export function DocSearchModal({
156162 onSelect ( { item, event } ) {
157163 saveRecentSearch ( item ) ;
158164
159- if ( ! event . shiftKey && ! event . ctrlKey && ! event . metaKey ) {
165+ if ( ! isModifierEvent ( event ) ) {
160166 onClose ( ) ;
161167 }
162168 } ,
@@ -172,7 +178,7 @@ export function DocSearchModal({
172178 onSelect ( { item, event } ) {
173179 saveRecentSearch ( item ) ;
174180
175- if ( ! event . shiftKey && ! event . ctrlKey && ! event . metaKey ) {
181+ if ( ! isModifierEvent ( event ) ) {
176182 onClose ( ) ;
177183 }
178184 } ,
@@ -256,7 +262,7 @@ export function DocSearchModal({
256262 onSelect ( { item, event } ) {
257263 saveRecentSearch ( item ) ;
258264
259- if ( ! event . shiftKey && ! event . ctrlKey && ! event . metaKey ) {
265+ if ( ! isModifierEvent ( event ) ) {
260266 onClose ( ) ;
261267 }
262268 } ,
@@ -431,9 +437,11 @@ export function DocSearchModal({
431437 inputRef = { inputRef }
432438 translations = { screenStateTranslations }
433439 getMissingResultsUrl = { getMissingResultsUrl }
434- onItemClick = { ( item ) => {
440+ onItemClick = { ( item , event ) => {
435441 saveRecentSearch ( item ) ;
436- onClose ( ) ;
442+ if ( ! isModifierEvent ( event ) ) {
443+ onClose ( ) ;
444+ }
437445 } }
438446 />
439447 </ div >
0 commit comments