From 4d6844eb2f488e0ffb6bc15c6b2e3fc04fd36cad Mon Sep 17 00:00:00 2001 From: J H Date: Tue, 30 Jan 2024 13:38:49 +0000 Subject: [PATCH] [Glitch] Fixed the toggle emoji dropdown bug Port 1467f1e1e1c18dc4b310862ff1f719165a24cfb6 to glitch-soc Signed-off-by: Claire --- .../features/compose/components/emoji_picker_dropdown.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.jsx b/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.jsx index 0846468c4e..557f60e807 100644 --- a/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.jsx @@ -165,6 +165,7 @@ class EmojiPickerMenuImpl extends PureComponent { intl: PropTypes.object.isRequired, skinTone: PropTypes.number.isRequired, onSkinTone: PropTypes.func.isRequired, + pickerButtonRef: PropTypes.func.isRequired }; static defaultProps = { @@ -179,7 +180,7 @@ class EmojiPickerMenuImpl extends PureComponent { }; handleDocumentClick = e => { - if (this.node && !this.node.contains(e.target)) { + if (this.node && !this.node.contains(e.target) && !this.props.pickerButtonRef.contains(e.target)) { this.props.onClose(); } }; @@ -234,6 +235,7 @@ class EmojiPickerMenuImpl extends PureComponent { emoji.native = emoji.colons; } if (!(event.ctrlKey || event.metaKey)) { + this.props.onClose(); } this.props.onPick(emoji); @@ -409,6 +411,7 @@ class EmojiPickerDropdown extends PureComponent { onSkinTone={onSkinTone} skinTone={skinTone} frequentlyUsedEmojis={frequentlyUsedEmojis} + pickerButtonRef={this.target} />