Fix inline compose form clickable area, fixes #30

This commit is contained in:
Alex Gleason 2020-04-20 16:53:22 -05:00
parent de703ab748
commit 0ec8e39051
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -105,10 +105,16 @@ class ComposeForm extends ImmutablePureComponent {
return clickableAreaRef ? clickableAreaRef.current : this.form;
}
shouldCollapse = (e) => {
return ![
this.getClickableArea(),
document.querySelector('.privacy-dropdown__dropdown'),
document.querySelector('.emoji-picker-dropdown__menu'),
].some(element => element && element.contains(e.target));
}
handleClick = (e) => {
const clickableArea = this.getClickableArea();
if (!clickableArea) return;
if (!clickableArea.contains(e.target)) {
if (this.shouldCollapse(e)) {
this.handleClickOutside();
}
}