mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +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:
parent
d7d2de04bd
commit
6f46253e62
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user