diff --git a/app/assets/javascripts/discourse/app/widgets/search-menu.js b/app/assets/javascripts/discourse/app/widgets/search-menu.js index 00f98ada54a..cf222e76506 100644 --- a/app/assets/javascripts/discourse/app/widgets/search-menu.js +++ b/app/assets/javascripts/discourse/app/widgets/search-menu.js @@ -348,10 +348,17 @@ export default createWidget("search-menu", { }); }, + mouseDown(e) { + if (e.target === document.querySelector("input#search-term")) { + this.state.inputSelectionEvent = true; + } + }, + clickOutside() { - if (this.key === "search-menu" && !window.getSelection().toString()) { + if (this.key === "search-menu" && !this.state.inputSelectionEvent) { this.sendWidgetAction("toggleSearchMenu"); } + this.state.inputSelectionEvent = false; }, clearTopicContext() {