diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-12-03 18:45:25 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-03 18:45:25 -0800 |
commit | a01497fed41b098d05b397e336be32dc6fe48bca (patch) | |
tree | 8aa34aff491c00c1e55c7d3cb1ac50a06425115f /src | |
parent | 0ab19b45a24253e2666df2b1722fb904423fa93d (diff) | |
download | voidsky-a01497fed41b098d05b397e336be32dc6fe48bca.tar.zst |
Hackfix to composer focus on web (#2057)
Diffstat (limited to 'src')
-rw-r--r-- | src/view/com/composer/text-input/TextInput.web.tsx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/view/com/composer/text-input/TextInput.web.tsx b/src/view/com/composer/text-input/TextInput.web.tsx index 4c31da338..206a3205b 100644 --- a/src/view/com/composer/text-input/TextInput.web.tsx +++ b/src/view/com/composer/text-input/TextInput.web.tsx @@ -116,6 +116,16 @@ export const TextInput = React.forwardRef(function TextInputImpl( autofocus: 'end', editable: true, injectCSS: true, + onCreate({editor: editorProp}) { + // HACK + // the 'enter' animation sometimes causes autofocus to fail + // (see Composer.web.tsx in shell) + // so we wait 200ms (the anim is 150ms) and then focus manually + // -prf + setTimeout(() => { + editorProp.chain().focus('end').run() + }, 200) + }, onUpdate({editor: editorProp}) { const json = editorProp.getJSON() |