From 54897521017e72957661cd991c5d6492538bead9 Mon Sep 17 00:00:00 2001 From: "Jan C. Borchardt" <925062+jancborchardt@users.noreply.github.com> Date: Mon, 20 Apr 2026 14:54:47 +0200 Subject: [PATCH] fix(composer): Don't show 'No results' dropdown when To/Cc/Bcc focused, only with search term put in fix(composer): Don't show 'No results' dropdown when To/Cc/Bcc focused, only with search term put in AI-assisted: GitHub Copilot (OpenAI GPT-5.4) Signed-off-by: Jan C. Borchardt <925062+jancborchardt@users.noreply.github.com> [skip ci] --- src/components/Composer.vue | 7 +++ .../unit/components/Composer.vue.spec.js | 54 +++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/src/components/Composer.vue b/src/components/Composer.vue index c6442b8a92..917dcb8d9f 100644 --- a/src/components/Composer.vue +++ b/src/components/Composer.vue @@ -57,6 +57,7 @@ :taggable="true" :aria-label-combobox="t('mail', 'Select recipient')" :filter-by="(option, label, search) => filterOption(option, label, search, 'to')" + :dropdown-should-open="shouldOpenRecipientDropdown" :multiple="true" :clear-search-on-select="true" :loading="loadingIndicatorTo" @@ -112,6 +113,7 @@ :get-option-key="(option) => option.email" :no-wrap="false" :filter-by="(option, label, search) => filterOption(option, label, search, 'cc')" + :dropdown-should-open="shouldOpenRecipientDropdown" :taggable="true" :clear-search-on-blur="() => clearOnBlur('cc')" :append-to-body="false" @@ -169,6 +171,7 @@ :filter-by="(option, label, search) => filterOption(option, label, search, 'bcc')" :options="selectableRecipients.filter(recipient => !selectBcc.some(bcc => bcc.email === recipient.email))" :get-option-key="(option) => option.email" + :dropdown-should-open="shouldOpenRecipientDropdown" :taggable="true" :clear-search-on-blur="() => clearOnBlur('bcc')" :append-to-body="false" @@ -1172,6 +1175,10 @@ export default { || (option?.email || '').toLocaleLowerCase().includes(searchInLowerCase) }, + shouldOpenRecipientDropdown({ noDrop, open, search }) { + return !noDrop && open && search.trim() !== '' + }, + setAlias() { const previous = this.selectedAlias if (this.fromAccount && this.fromAlias) { diff --git a/src/tests/unit/components/Composer.vue.spec.js b/src/tests/unit/components/Composer.vue.spec.js index 385cf21827..3c39c7c230 100644 --- a/src/tests/unit/components/Composer.vue.spec.js +++ b/src/tests/unit/components/Composer.vue.spec.js @@ -317,4 +317,58 @@ describe('Composer', () => { expect(view.vm.submitButtonTitle).toEqual('Encrypt with Mailvelope and send later Jan 1, 02:00 PM') }) + + it('does not open the recipient dropdown on focus without a search term', () => { + const view = shallowMount(Composer, { + propsData: { + isFirstOpen: true, + accounts: [ + { + id: 123, + editorMode: 'plaintext', + isUnified: false, + aliases: [], + }, + ], + }, + mocks: { + $route, + }, + store, + localVue, + }) + + expect(view.vm.shouldOpenRecipientDropdown({ + noDrop: false, + open: true, + search: '', + })).toEqual(false) + }) + + it('opens the recipient dropdown once a search term is entered', () => { + const view = shallowMount(Composer, { + propsData: { + isFirstOpen: true, + accounts: [ + { + id: 123, + editorMode: 'plaintext', + isUnified: false, + aliases: [], + }, + ], + }, + mocks: { + $route, + }, + store, + localVue, + }) + + expect(view.vm.shouldOpenRecipientDropdown({ + noDrop: false, + open: true, + search: 'alice', + })).toEqual(true) + }) })