Fix inline compose form clickable area, fixes #30
This commit is contained in:
parent
de703ab748
commit
0ec8e39051
1 changed files with 9 additions and 3 deletions
|
@ -105,10 +105,16 @@ class ComposeForm extends ImmutablePureComponent {
|
||||||
return clickableAreaRef ? clickableAreaRef.current : this.form;
|
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) => {
|
handleClick = (e) => {
|
||||||
const clickableArea = this.getClickableArea();
|
if (this.shouldCollapse(e)) {
|
||||||
if (!clickableArea) return;
|
|
||||||
if (!clickableArea.contains(e.target)) {
|
|
||||||
this.handleClickOutside();
|
this.handleClickOutside();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue