From e44b333660cad53ee9d077d30f5b790336580e9d Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 24 Jun 2025 11:08:00 +0200 Subject: [PATCH] [Glitch] Fix Firefox not updating spellcheck language in textarea Port c4128d89c97b33d265eb22c211ec66376e4827da to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/components/autosuggest_textarea.jsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx b/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx index 07fbccacc9..c7ec3779f3 100644 --- a/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx +++ b/app/javascript/flavours/glitch/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;