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

implement keyboard navigation to pick emoji

https://youtrack.weseek.co.jp/issue/GW-7798
- Get element of emoji category list
- Get element of emojis based on input
Mudana-Grune 4 лет назад
Родитель
Сommit
5d15467a3a
1 измененных файлов с 10 добавлено и 1 удалено
  1. 10 1
      packages/app/src/components/PageEditor/EmojiPicker.tsx

+ 10 - 1
packages/app/src/components/PageEditor/EmojiPicker.tsx

@@ -22,14 +22,23 @@ const EmojiPicker: FC<Props> = (props: Props) => {
 
   // Set search emoji input and trigger search
   const searchEmoji = () => {
+    const input = window.document.querySelector('[id^="emoji-mart-search"]') as HTMLInputElement;
     if (emojiSearchText !== null) {
-      const input = window.document.querySelector('[id^="emoji-mart-search"]') as HTMLInputElement;
+
       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 emojiCategoryList = window.document.querySelector('.emoji-mart-category-list');
+
+    input.addEventListener('input', () => {
+      console.log(emojiCategoryList?.childNodes);
+    });
+
   };
 
   const selectEmoji = (emoji) => {