From 488f716c165517556a061de54868a14aeb6ca0a4 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Thu, 7 Oct 2021 16:17:14 -0400 Subject: [PATCH] FIX: Apply quote selection workaround to all browsers (#14558) Firefox also needs this. --- .../discourse/app/components/quote-button.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/quote-button.js b/app/assets/javascripts/discourse/app/components/quote-button.js index 783b0ab8b1a..50d3793f0fa 100644 --- a/app/assets/javascripts/discourse/app/components/quote-button.js +++ b/app/assets/javascripts/discourse/app/components/quote-button.js @@ -176,7 +176,7 @@ export default Component.extend(KeyEnterEscape, { // on Desktop, shows the button at the beginning of the selection // on Mobile, shows the button at the end of the selection const isMobileDevice = this.site.isMobileDevice; - const { isIOS, isAndroid, isSafari, isOpera } = this.capabilities; + const { isIOS, isAndroid, isOpera } = this.capabilities; const showAtEnd = isMobileDevice || isIOS || isAndroid || isOpera; // 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(); - // work around Safari that would sometimes lose the selection - if (isSafari) { - this._reselected = true; - selection.removeAllRanges(); - selection.addRange(clone); - } + // workaround so Safari and Firefox don't lose the selection + this._reselected = true; + selection.removeAllRanges(); + selection.addRange(clone); }); },