Skip to content

Commit

Permalink
Fixed the toggle emoji dropdown bug (mastodon#29012)
Browse files Browse the repository at this point in the history
  • Loading branch information
jh97uk authored Jan 30, 2024
1 parent ff8937a commit 1467f1e
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class EmojiPickerMenuImpl extends PureComponent {
intl: PropTypes.object.isRequired,
skinTone: PropTypes.number.isRequired,
onSkinTone: PropTypes.func.isRequired,
pickerButtonRef: PropTypes.func.isRequired
};

static defaultProps = {
Expand All @@ -178,7 +179,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();
}
};
Expand Down Expand Up @@ -233,6 +234,7 @@ class EmojiPickerMenuImpl extends PureComponent {
emoji.native = emoji.colons;
}
if (!(event.ctrlKey || event.metaKey)) {

this.props.onClose();
}
this.props.onPick(emoji);
Expand Down Expand Up @@ -407,6 +409,7 @@ class EmojiPickerDropdown extends PureComponent {
onSkinTone={onSkinTone}
skinTone={skinTone}
frequentlyUsedEmojis={frequentlyUsedEmojis}
pickerButtonRef={this.target}
/>
</div>
</div>
Expand Down

0 comments on commit 1467f1e

Please sign in to comment.