1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00

Fix menu-droppo external click handler (#10311)

The `menu-droppo` external click handler would fail to update when the
prop changed while the menu wasn't shown. This bug isn't exposed
anywhere yet as far as I know, but I ran into it when working on a
different bug fix.
This commit is contained in:
Mark Stacey 2021-01-29 17:04:15 -03:30 committed by GitHub
parent d7d2de04bd
commit 6f46253e62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,14 +31,6 @@ export default class MenuDroppoComponent extends Component {
)
}
manageListeners() {
const { isOpen, onClickOutside } = this.props
if (isOpen) {
this.outsideClickHandler = onClickOutside
}
}
globalClickOccurred = (event) => {
const { target } = event
// eslint-disable-next-line react/no-find-dom-node
@ -47,9 +39,9 @@ export default class MenuDroppoComponent extends Component {
if (
target !== container &&
!isDescendant(this.container, event.target) &&
this.outsideClickHandler
this.props.onClickOutside
) {
this.outsideClickHandler(event)
this.props.onClickOutside(event)
}
}
@ -74,8 +66,6 @@ export default class MenuDroppoComponent extends Component {
const { useCssTransition } = this.props
const zIndex = 'zIndex' in this.props ? this.props.zIndex : 0
this.manageListeners()
const baseStyle = {
position: 'fixed',
...style,