diff --git a/packages/frontend/src/components/MkEmojiPicker.vue b/packages/frontend/src/components/MkEmojiPicker.vue index 6b1add81bc..cf7087d798 100644 --- a/packages/frontend/src/components/MkEmojiPicker.vue +++ b/packages/frontend/src/components/MkEmojiPicker.vue @@ -218,13 +218,15 @@ parseAndMergeCategories('', customEmojiFolderRoot); watch(q, () => { if (emojisEl.value) emojisEl.value.scrollTop = 0; - if (q.value === '') { + const query = q.value.trim(); + + if (query === '') { searchResultCustom.value = []; searchResultUnicode.value = []; return; } - const newQ = q.value.replace(/:/g, '').normalize('NFC').toLowerCase(); + const newQ = query.replace(/:/g, '').normalize('NFC').toLowerCase(); const searchCustom = () => { const max = 100; @@ -442,7 +444,7 @@ function input(): void { // Using custom input event instead of v-model to respond immediately on // Android, where composition happens on all languages // (v-model does not update during composition) - q.value = searchEl.value?.value.trim() ?? ''; + q.value = searchEl.value?.value ?? ''; } function paste(event: ClipboardEvent): void { @@ -467,7 +469,7 @@ function onKeydown(ev: KeyboardEvent) { } function done(query?: string): boolean | void { - if (query == null) query = q.value; + if (query == null) query = q.value.trim(); if (query == null || typeof query !== 'string') return; const q2 = query.replace(/:/g, '');