Skip to content

A platform for community discussion. Free, open, simple.

UX: show all quote share buttons by default (#37417)

Krisfb5892408e4b
diff --git a/app/assets/stylesheets/common/base/topic-post.scss b/app/assets/stylesheets/common/base/topic-post.scss
index f705ae948ec..b89a3e31b58 100644
--- a/app/assets/stylesheets/common/base/topic-post.scss
+++ b/app/assets/stylesheets/common/base/topic-post.scss
@@ -773,10 +773,6 @@ aside.quote {
width: 100%;
}
- .insert-quote + .quote-sharing {
- border-left: 1px solid rgb(255, 255, 255, 0.3);
- }
-
.btn-flat {
&:hover {
.d-icon {
@@ -788,59 +784,6 @@ aside.quote {
white-space: nowrap;
}
}
-
- .quote-sharing {
- vertical-align: middle;
- display: inline-flex;
- align-items: center;
-
- .btn {
- display: inline-flex;
- align-items: center;
- }
-
- .quote-share-label {
- opacity: 1;
- transition: opacity 0.3s ease-in-out;
- }
-
- &:hover {
- .quote-share-label {
- background: transparent;
- opacity: 0;
- max-width: 0;
- padding: 0;
- overflow: hidden;
- }
-
- .quote-share-label + .quote-share-buttons {
- max-width: 10em;
- opacity: 1;
- transition: opacity 0.3s ease-in-out;
- }
-
- // this pseudo element creates a transition buffer zone
- // without it, the width change on hover can cause transition jitter
- // the width is roughly wide enough to cover long translations of "share"
- &::after {
- content: "";
- position: absolute;
- display: block;
- background: transparent;
- height: 100%;
- padding: 0.5em 4em;
- z-index: -1; // below the buttons
- }
- }
-
- .quote-share-label + .quote-share-buttons {
- opacity: 0;
- overflow: hidden;
- max-width: 0;
- display: inline-flex;
- transition: opacity 0.3s ease-in-out;
- }
- }
}
#fast-edit-input {
diff --git a/frontend/discourse/app/components/post-text-selection-toolbar.gjs b/frontend/discourse/app/components/post-text-selection-toolbar.gjs
index 0253e819b08..bf393525931 100644
--- a/frontend/discourse/app/components/post-text-selection-toolbar.gjs
+++ b/frontend/discourse/app/components/post-text-selection-toolbar.gjs
@@ -51,10 +51,6 @@ export default class PostTextSelectionToolbar extends Component {
);
}
- get quoteSharingShowLabel() {
- return this.quoteSharingSources.length > 1;
- }
-
get shareUrl() {
return getAbsoluteURL(
postUrl(this.topic.slug, this.topic.id, this.post.post_number)
@@ -139,32 +135,20 @@ export default class PostTextSelectionToolbar extends Component {
/>
{{#if this.quoteSharingEnabled}}
- <span class="quote-sharing">
- {{#if this.quoteSharingShowLabel}}
- <DButton
- @icon="share"
- @label="post.quote_share"
- class="btn-flat quote-share-label"
- />
- {{/if}}
-
- <span class="quote-share-buttons">
- {{#each this.quoteSharingSources as |source|}}
- <DButton
- @action={{fn this.share source}}
- @translatedTitle={{source.title}}
- @icon={{source.icon}}
- class="btn-flat"
- />
- {{/each}}
-
- <PluginOutlet
- @name="quote-share-buttons-after"
- @connectorTagName="span"
- @outletArgs={{lazyHash data=@data}}
- />
- </span>
- </span>
+ {{#each this.quoteSharingSources as |source|}}
+ <DButton
+ @action={{fn this.share source}}
+ @translatedTitle={{source.title}}
+ @icon={{source.icon}}
+ class="btn-flat"
+ />
+ {{/each}}
+
+ <PluginOutlet
+ @name="quote-share-buttons-after"
+ @connectorTagName="span"
+ @outletArgs={{lazyHash data=@data}}
+ />
{{/if}}
</PluginOutlet>
</div>
diff --git a/frontend/discourse/tests/acceptance/topic-quote-button-test.js b/frontend/discourse/tests/acceptance/topic-quote-button-test.js
index 3f5ffe0b18f..8f9fa0996d9 100644
--- a/frontend/discourse/tests/acceptance/topic-quote-button-test.js
+++ b/frontend/discourse/tests/acceptance/topic-quote-button-test.js
@@ -29,7 +29,9 @@ acceptance("Topic - Quote button - logged in", function (needs) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
assert.dom(".insert-quote").exists("shows the quote button");
- assert.dom(".quote-sharing").doesNotExist("does not show quote sharing");
+ assert
+ .dom(`.btn[title='${i18n("share.email")}']`)
+ .doesNotExist("does not show quote sharing");
});
test("Shows quote share buttons with the right site settings", async function (assert) {
@@ -38,12 +40,11 @@ acceptance("Topic - Quote button - logged in", function (needs) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
- assert.dom(".quote-sharing").exists("shows the quote sharing options");
assert
- .dom(`.quote-sharing .btn[title='${i18n("share.twitter")}']`)
+ .dom(`.btn[title='${i18n("share.twitter")}']`)
.exists("includes the twitter share button");
assert
- .dom(`.quote-sharing .btn[title='${i18n("share.email")}']`)
+ .dom(`.btn[title='${i18n("share.email")}']`)
.exists("includes the email share button");
});
@@ -97,38 +98,24 @@ acceptance("Topic - Quote button - anonymous", function (needs) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
- assert.dom(".quote-sharing").exists("shows the quote sharing options");
assert
- .dom(`.quote-sharing .btn[title='${i18n("share.twitter")}']`)
+ .dom(`.btn[title='${i18n("share.twitter")}']`)
.exists("includes the twitter share button");
assert
- .dom(`.quote-sharing .btn[title='${i18n("share.email")}']`)
+ .dom(`.btn[title='${i18n("share.email")}']`)
.exists("includes the email share button");
assert.dom(".insert-quote").doesNotExist("does not show the quote button");
});
- test("Shows single share button when site setting only has one item", async function (assert) {
- this.siteSettings.share_quote_buttons = "twitter";
-
- await visit("/t/internationalization-localization/280");
- await selectText("#post_5 blockquote");
-
- assert.dom(".quote-sharing").exists("shows the quote sharing options");
- assert
- .dom(`.quote-sharing .btn[title='${i18n("share.twitter")}']`)
- .exists("includes the twitter share button");
- assert
- .dom(".quote-share-label")
- .doesNotExist("does not show the Share label");
- });
-
test("Shows nothing when visibility is disabled", async function (assert) {
this.siteSettings.share_quote_visibility = "none";
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
- assert.dom(".quote-sharing").doesNotExist("does not show quote sharing");
+ assert
+ .dom(`.btn[title='${i18n("share.email")}']`)
+ .doesNotExist("does not show quote sharing");
assert.dom(".insert-quote").doesNotExist("does not show the quote button");
});
});