diff --git a/app/gabsocial/features/compose/components/compose_form.js b/app/gabsocial/features/compose/components/compose_form.js index 7de594479..d6e15482b 100644 --- a/app/gabsocial/features/compose/components/compose_form.js +++ b/app/gabsocial/features/compose/components/compose_form.js @@ -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(); } }