Просмотр исходного кода

Auto focus on open emojiPicker from icon

https://youtrack.weseek.co.jp/issue/GW-7810
- Set focus to search input when emojiPicker opened from icon
I Komang Mudana 3 лет назад
Родитель
Сommit
6f02e87468
1 измененных файлов с 5 добавлено и 8 удалено
  1. 5 8
      packages/app/src/components/PageEditor/EmojiPicker.tsx

+ 5 - 8
packages/app/src/components/PageEditor/EmojiPicker.tsx

@@ -23,14 +23,11 @@ const EmojiPicker: FC<Props> = (props: Props) => {
   // Set search emoji input and trigger search
   // Set search emoji input and trigger search
   const searchEmoji = () => {
   const searchEmoji = () => {
     const input = window.document.querySelector('[id^="emoji-mart-search"]') as HTMLInputElement;
     const input = window.document.querySelector('[id^="emoji-mart-search"]') as HTMLInputElement;
-    if (emojiSearchText !== null) {
-
-      const valueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value')?.set;
-      valueSetter?.call(input, emojiSearchText);
-      const event = new Event('input', { bubbles: true });
-      input.dispatchEvent(event);
-      input.focus();
-    }
+    const valueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value')?.set;
+    valueSetter?.call(input, emojiSearchText);
+    const event = new Event('input', { bubbles: true });
+    input.dispatchEvent(event);
+    input.focus();
   };
   };
 
 
   const selectEmoji = (emoji) => {
   const selectEmoji = (emoji) => {