diff --git a/app/assets/javascripts/discourse/widgets/search-menu-controls.js.es6 b/app/assets/javascripts/discourse/widgets/search-menu-controls.js.es6 index 0fe748669ef..eae413b877e 100644 --- a/app/assets/javascripts/discourse/widgets/search-menu-controls.js.es6 +++ b/app/assets/javascripts/discourse/widgets/search-menu-controls.js.es6 @@ -6,9 +6,11 @@ createWidget('search-term', { tagName: 'input', buildId: () => 'search-term', buildKey: (attrs) => `search-term-${attrs.id}`, + KEYCODE_AT_SIGN: 50, + KEYCODE_POUND_SIGN: 51, defaultState() { - return { autocompleteIsOpen: false }; + return { autocompleteIsOpen: false, shiftKeyEntry: false }; }, buildAttributes(attrs) { @@ -19,6 +21,9 @@ createWidget('search-term', { keyDown(e) { const state = this.state; + state.shiftKeyEntry = e.shiftKey && + (e.keyCode === this.KEYCODE_AT_SIGN || e.keyCode === this.KEYCODE_POUND_SIGN); + if ($(`#${this.buildId()}`).parent().find('.autocomplete').length !== 0) { state.autocompleteIsOpen = true; } else { @@ -27,7 +32,8 @@ createWidget('search-term', { }, keyUp(e) { - if (e.which === 13 && !this.state.autocompleteIsOpen) { + const state = this.state; + if (e.which === 13 && !state.shiftKeyEntry && !state.autocompleteIsOpen) { return this.sendWidgetAction('fullSearch'); }