fix: Don't apply layout hack in Firefox Mobile while editing text (#5531) This fixes the following bug in Firefox Mobile on Android: **Steps to reproduce:** 1. Swipe a word into the chat input edit field in Firefox Mobile on Android, for examples "Test". 2. In GBoard (default Android keyboard), tap on a different suggestion, for examples "Rest". **Expected behavior:** The word "Test" is replaced with "Rest". **Actual behavior:** The word becomes "TestRest". I confirmed with bisecting that the commit f897a4ab1a0ca87e4afa50dfb3e926de057ec6ea introduced the issue. This change fixes the issue by disabling the layout hack while editing text. Disabling the layout hack is limited to Firefox Mobile because * I could not reproduce the bug in Chrome on Android * This way, if it causes a new bug, only Firefox Mobile users are affected

29e3136473f1525503d05572fbc902342c91d806

Christoph <code@yozora.eu>

Signed
1 files changed, +8 -0Ignore whitespace
public/scripts/browser-fixes.js+8 -0
@@ -72,6 +72,14 @@ function applyBrowserFixes() {
7272
7373 if (isMobile()) {
7474 const fixFunkyPositioning = () => {
75+ if (isFirefox()) {
76+ const active = document.activeElement;
77+ if (active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement) {
78+ // The positioning hack below breaks GBoard candidate replacement
79+ // in Firefox Mobile on Android.
80+ return;
81+ }
82+ }
7583 console.debug('[Mobile] Device viewport change detected.');
7684 document.documentElement.style.position = 'fixed';
7785 requestAnimationFrame(() => document.documentElement.style.position = '');