From b1e40d04b9ccec66085619a0ecef376584292374 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Thu, 9 Jan 2025 14:27:48 +0100 Subject: [PATCH] FIX: emoji picker followups (#30670) This pull request is doing the following changes: prevents clicking on a section to scroll the document body do not show favorites section if empty do not close the user-status modal on emoji selection giving its own context for user-status picker, that way if you frequently use same emojis for the picker they will always be in favorites --- .../app/components/emoji-picker/content.gjs | 46 ++++++++++--------- .../app/components/emoji-picker/index.gjs | 6 ++- .../app/components/user-status-picker.gjs | 2 + .../components/emoji-picker-test.js | 2 +- .../common/components/emoji-picker.scss | 2 +- 5 files changed, 33 insertions(+), 25 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/emoji-picker/content.gjs b/app/assets/javascripts/discourse/app/components/emoji-picker/content.gjs index e1f2e9f9582..ae5a394c256 100644 --- a/app/assets/javascripts/discourse/app/components/emoji-picker/content.gjs +++ b/app/assets/javascripts/discourse/app/components/emoji-picker/content.gjs @@ -336,7 +336,7 @@ export default class EmojiPicker extends Component { const targetEmoji = document.querySelector( `.emoji-picker__section[data-section="${section}"]` ); - targetEmoji.scrollIntoView({ block: "start" }); + targetEmoji.scrollIntoView({ block: "nearest" }); // iOS hack to avoid blank div when requesting section during momentum if (this.scrollableNode && this.capabilities.isIOS) { @@ -473,27 +473,29 @@ export default class EmojiPicker extends Component {
{{#each-in this.groups as |section emojis|}} - - {{#if (eq section "favorites")}} - {{replaceEmoji ":star:"}} - {{else}} - - {{/if}} - + {{#if emojis.length}} + + {{#if (eq section "favorites")}} + {{replaceEmoji ":star:"}} + {{else}} + + {{/if}} + + {{/if}} {{/each-in}}
diff --git a/app/assets/javascripts/discourse/app/components/emoji-picker/index.gjs b/app/assets/javascripts/discourse/app/components/emoji-picker/index.gjs index f3da70e563e..07429aef4dd 100644 --- a/app/assets/javascripts/discourse/app/components/emoji-picker/index.gjs +++ b/app/assets/javascripts/discourse/app/components/emoji-picker/index.gjs @@ -21,6 +21,10 @@ export default class EmojiPicker extends Component { return this.args.context ?? "topic"; } + get modalForMobile() { + return this.args.modalForMobile ?? true; + } +