FIX: Resolve quoting issues by reverting new shortcuts (#14560)

FIX: Resolve quoting issues by reverting new shortcuts (#14560)

This reverts the new e and q shortcuts for quick-edit, and quote. The current implementation of these is causing issues with quoting on mobile devices.

We intend restore these new shortcuts soon.

  • Revert “FIX: Apply quote selection workaround to all browsers (#14558)”

This reverts commit 488f716c165517556a061de54868a14aeb6ca0a4.

  • Revert “FIX: selection going missing in Safari (#14557)”

This reverts commit 538fe2cc31d9210ae6322ae2ccaf96c69a1850a5.

  • Revert “UX: adds shortcuts for quote (q) and fast edit (e) (#14552)”

This reverts commit 2af6052307ab866e58c3fba0edf7040a2d8097f0.

diff --git a/app/assets/javascripts/discourse/app/components/quote-button.js b/app/assets/javascripts/discourse/app/components/quote-button.js
index 50d3793..a41198a 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, isOpera } = this.capabilities;
+    const { isIOS, isAndroid, isSafari, isOpera } = this.capabilities;
     const showAtEnd = isMobileDevice || isIOS || isAndroid || isOpera;
 
     // Don't mess with the original range as it results in weird behaviours
@@ -206,6 +206,13 @@ export default Component.extend(KeyEnterEscape, {
     // merge back all text nodes so they don't get messed up
     parent.normalize();
 
+    // work around Safari that would sometimes lose the selection
+    if (isSafari) {
+      this._reselected = true;
+      selection.removeAllRanges();
+      selection.addRange(clone);
+    }
+
     // change the position of the button
     schedule("afterRender", () => {
       if (!this.element || this.isDestroying || this.isDestroyed) {
@@ -225,13 +232,6 @@ export default Component.extend(KeyEnterEscape, {
       }
 
       $quoteButton.offset({ top, left });
-
-      this.element.querySelector("button")?.focus();
-
-      // workaround so Safari and Firefox don't lose the selection
-      this._reselected = true;
-      selection.removeAllRanges();
-      selection.addRange(clone);
     });
   },
 
@@ -279,24 +279,6 @@ export default Component.extend(KeyEnterEscape, {
       });
   },
 
-  keyDown(event) {
-    this._super(...arguments);
-
-    if (!this.visible) {
-      return;
-    }
-
-    if (!this._displayFastEditInput && event.key === "e") {
-      this._toggleFastEditForm();
-      return false;
-    }
-
-    if (event.key === "q") {
-      this.insertQuote();
-      return false;
-    }
-  },
-
   willDestroyElement() {
     $(document)
       .off("mousedown.quote-button")
diff --git a/app/assets/javascripts/discourse/app/templates/components/quote-button.hbs b/app/assets/javascripts/discourse/app/templates/components/quote-button.hbs
index d486a77..38d4d4d 100644
--- a/app/assets/javascripts/discourse/app/templates/components/quote-button.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/quote-button.hbs
@@ -4,9 +4,7 @@
       class="btn-flat insert-quote"
       action=(action "insertQuote")
       icon="quote-left"
-      label="post.quote_reply"
-      title="post.quote_reply_shortcut"
-    }}
+      label="post.quote_reply"}}
   {{/if}}
 
   {{#if siteSettings.enable_fast_edit}}
@@ -16,7 +14,6 @@
         action=(action "_toggleFastEditForm")
         label="post.quote_edit"
         class="btn-flat quote-edit-label"
-        title="post.quote_edit_shortcut"
       }}
     {{/if}}
   {{/if}}
diff --git a/app/assets/stylesheets/common/base/topic-post.scss b/app/assets/stylesheets/common/base/topic-post.scss
index 6750449..65fb9b1 100644
--- a/app/assets/stylesheets/common/base/topic-post.scss
+++ b/app/assets/stylesheets/common/base/topic-post.scss
@@ -423,12 +423,6 @@ aside.quote {
     color: var(--secondary-or-primary);
   }
 
-  .btn:focus:not(:hover),
-  .btn:focus:not(:hover) .d-icon {
-    color: var(--secondary);
-    background-color: var(--secondary-high);
-  }
-
   .insert-quote + .quote-sharing {
     border-left: 1px solid rgba(255, 255, 255, 0.3);
   }
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 044263b..c3f55f0 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -3016,9 +3016,7 @@ en:
 
     post:
       quote_reply: "Quote"
-      quote_reply_shortcut: "Or press q"
       quote_edit: "Edit"
-      quote_edit_shortcut: "Or press e"
       quote_share: "Share"
       edit_reason: "Reason: "
       post_number: "post %{number}"

GitHub sha: ce0daae636727c40ac9b483e0aff8aab034c6f55

1 Like

This commit appears in #14560 which was approved by romanrizzi. It was merged by davidtaylorhq.

This commit has been mentioned on Discourse Meta. There might be relevant details there: