From b78a00a306b4d91c29103fac128d7cacb5cefef6 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 28 Sep 2020 19:05:56 -0500 Subject: [PATCH] Revert "pass getClickableArea into autosuggesttextarea as prop" This reverts commit 99f0a069dd6092e7d9c835a5f2ffc2db42bf14bf. --- app/soapbox/components/autosuggest_textarea.js | 8 ++++++-- app/soapbox/features/compose/components/compose_form.js | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/soapbox/components/autosuggest_textarea.js b/app/soapbox/components/autosuggest_textarea.js index 703aa9797..e60661f6b 100644 --- a/app/soapbox/components/autosuggest_textarea.js +++ b/app/soapbox/components/autosuggest_textarea.js @@ -51,7 +51,6 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { onFocus: PropTypes.func, onBlur: PropTypes.func, clickableAreaRef: PropTypes.object, - getClickableArea: PropTypes.func.isRequired, }; static defaultProps = { @@ -165,9 +164,14 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { this.textarea.focus(); } + getClickableArea = () => { + const { clickableAreaRef } = this.props; + return clickableAreaRef ? clickableAreaRef.current : this.form; + } + isClickInside = (e) => { return [ - this.props.getClickableArea(), + this.getClickableArea(), document.querySelector('.autosuggest-textarea__textarea'), ].some(element => element && element.contains(e.target)); } diff --git a/app/soapbox/features/compose/components/compose_form.js b/app/soapbox/features/compose/components/compose_form.js index 39647c923..af8ce4263 100644 --- a/app/soapbox/features/compose/components/compose_form.js +++ b/app/soapbox/features/compose/components/compose_form.js @@ -286,7 +286,6 @@ class ComposeForm extends ImmutablePureComponent { onSuggestionSelected={this.onSuggestionSelected} onPaste={onPaste} autoFocus={shouldAutoFocus} - getClickableArea={this.getClickableArea} > { !condensed &&