diff --git a/frontend/src/lib/components/CommandBar/searchBarLogic.ts b/frontend/src/lib/components/CommandBar/searchBarLogic.ts index c97781bf2141d..fd69e079ec1a5 100644 --- a/frontend/src/lib/components/CommandBar/searchBarLogic.ts +++ b/frontend/src/lib/components/CommandBar/searchBarLogic.ts @@ -115,8 +115,14 @@ export const searchBarLogic = kea([ // hide command bar actions.hideCommandBar() } else if (event.key === '>') { - if (values.searchQuery.length === 0) { - // transition to actions when entering '>' with empty input + const { value, selectionStart, selectionEnd } = event.target as HTMLInputElement + if ( + values.searchQuery.length === 0 || + (selectionStart !== null && + selectionEnd !== null && + (value.substring(0, selectionStart) + value.substring(selectionEnd)).length === 0) + ) { + // transition to actions when entering '>' with empty input, or when replacing the whole input event.preventDefault() actions.setCommandBar(BarStatus.SHOW_ACTIONS) }