From c4128d89c97b33d265eb22c211ec66376e4827da Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 24 Jun 2025 11:08:00 +0200 Subject: [PATCH] Fix Firefox not updating spellcheck language in textarea (#35148) --- .../mastodon/components/autosuggest_textarea.jsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/javascript/mastodon/components/autosuggest_textarea.jsx b/app/javascript/mastodon/components/autosuggest_textarea.jsx index 07fbccacc..c7ec3779f 100644 --- a/app/javascript/mastodon/components/autosuggest_textarea.jsx +++ b/app/javascript/mastodon/components/autosuggest_textarea.jsx @@ -162,6 +162,14 @@ const AutosuggestTextarea = forwardRef(({ } }, [suggestions, textareaRef, setSuggestionsHidden]); + // Hack to force Firefox to change language in autocorrect + useEffect(() => { + if (lang && textareaRef.current && textareaRef.current === document.activeElement) { + textareaRef.current.blur(); + textareaRef.current.focus(); + } + }, [lang]); + const renderSuggestion = (suggestion, i) => { let inner, key;