diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-02-26 21:15:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-26 21:15:19 +0100 |
commit | 551820cbd9e5beebd16f16205143e2263d4f2d51 (patch) | |
tree | 6868722efeb660c0031a22aecfdc4b2c5bc9dcc6 /app/javascript/flavours/glitch/features/compose | |
parent | e48eaf64cc7cb0cfab388331c4823ee5fb580d59 (diff) | |
parent | 67c6f37e269a4ebb538e019351f894183f3c1439 (diff) |
Merge pull request #1704 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/flavours/glitch/features/compose')
-rw-r--r-- | app/javascript/flavours/glitch/features/compose/components/compose_form.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.js b/app/javascript/flavours/glitch/features/compose/components/compose_form.js index c75906ce7..b03bc34b8 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js @@ -246,9 +246,14 @@ class ComposeForm extends ImmutablePureComponent { selectionStart = selectionEnd = text.length; } if (textarea) { - textarea.setSelectionRange(selectionStart, selectionEnd); - textarea.focus(); - if (!singleColumn) textarea.scrollIntoView(); + // Because of the wicg-inert polyfill, the activeElement may not be + // immediately selectable, we have to wait for observers to run, as + // described in https://github.com/WICG/inert#performance-and-gotchas + Promise.resolve().then(() => { + textarea.setSelectionRange(selectionStart, selectionEnd); + textarea.focus(); + if (!singleColumn) textarea.scrollIntoView(); + }).catch(console.error); } // Refocuses the textarea after submitting. |