FIX: Apply quote selection workaround to all browsers (#14558)

Firefox also needs this.
This commit is contained in:
Penar Musaraj 2021-10-07 16:17:14 -04:00 committed by GitHub
parent 538fe2cc31
commit 488f716c16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

View File

@ -176,7 +176,7 @@ export default Component.extend(KeyEnterEscape, {
// on Desktop, shows the button at the beginning of the selection // on Desktop, shows the button at the beginning of the selection
// on Mobile, shows the button at the end of the selection // on Mobile, shows the button at the end of the selection
const isMobileDevice = this.site.isMobileDevice; const isMobileDevice = this.site.isMobileDevice;
const { isIOS, isAndroid, isSafari, isOpera } = this.capabilities; const { isIOS, isAndroid, isOpera } = this.capabilities;
const showAtEnd = isMobileDevice || isIOS || isAndroid || isOpera; const showAtEnd = isMobileDevice || isIOS || isAndroid || isOpera;
// Don't mess with the original range as it results in weird behaviours // Don't mess with the original range as it results in weird behaviours
@ -228,12 +228,10 @@ export default Component.extend(KeyEnterEscape, {
this.element.querySelector("button")?.focus(); this.element.querySelector("button")?.focus();
// work around Safari that would sometimes lose the selection // workaround so Safari and Firefox don't lose the selection
if (isSafari) {
this._reselected = true; this._reselected = true;
selection.removeAllRanges(); selection.removeAllRanges();
selection.addRange(clone); selection.addRange(clone);
}
}); });
}, },