From 8de89895761876a2f8f174afb46b4e4dffc09ef2 Mon Sep 17 00:00:00 2001 From: Kris Date: Sun, 18 Jul 2021 21:34:44 -0400 Subject: [PATCH] UX: consistent share modal & popup, refactoring (#13759) --- .../discourse/app/components/share-popup.js | 7 +- .../app/templates/components/share-popup.hbs | 53 ++-- .../app/templates/components/share-source.hbs | 8 +- .../app/templates/modal/create-invite.hbs | 4 +- .../app/templates/modal/share-topic.hbs | 81 ++--- .../tests/acceptance/share-topic-test.js | 2 +- .../discourse/tests/acceptance/topic-test.js | 4 +- app/assets/stylesheets/common/base/modal.scss | 160 ---------- .../stylesheets/common/base/share_link.scss | 288 +++++++++++++----- 9 files changed, 305 insertions(+), 302 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/share-popup.js b/app/assets/javascripts/discourse/app/components/share-popup.js index a2d9decc137..85e815ce507 100644 --- a/app/assets/javascripts/discourse/app/components/share-popup.js +++ b/app/assets/javascripts/discourse/app/components/share-popup.js @@ -49,8 +49,11 @@ export default Component.extend({ if (this.element) { const linkInput = this.element.querySelector("#share-link input"); linkInput.value = this.link; - linkInput.setSelectionRange(0, this.link.length); - linkInput.focus(); + if (!this.site.mobileView) { + // if the input is auto-focused on mobile, iOS requires two taps of the copy button + linkInput.setSelectionRange(0, this.link.length); + linkInput.focus(); + } } }, 200); }, diff --git a/app/assets/javascripts/discourse/app/templates/components/share-popup.hbs b/app/assets/javascripts/discourse/app/templates/components/share-popup.hbs index 695be0aeb58..23e32ea4200 100644 --- a/app/assets/javascripts/discourse/app/templates/components/share-popup.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/share-popup.hbs @@ -4,13 +4,21 @@ {{#if date}} {{displayDate}} {{/if}} + + {{d-button + action=(action "close") + class="btn btn-flat close" + icon="times" + aria-label="share.close" + title="share.close" + }} -
- + -
+