mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +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) => {
|
globalClickOccurred = (event) => {
|
||||||
const { target } = event
|
const { target } = event
|
||||||
// eslint-disable-next-line react/no-find-dom-node
|
// eslint-disable-next-line react/no-find-dom-node
|
||||||
@ -47,9 +39,9 @@ export default class MenuDroppoComponent extends Component {
|
|||||||
if (
|
if (
|
||||||
target !== container &&
|
target !== container &&
|
||||||
!isDescendant(this.container, event.target) &&
|
!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 { useCssTransition } = this.props
|
||||||
const zIndex = 'zIndex' in this.props ? this.props.zIndex : 0
|
const zIndex = 'zIndex' in this.props ? this.props.zIndex : 0
|
||||||
|
|
||||||
this.manageListeners()
|
|
||||||
|
|
||||||
const baseStyle = {
|
const baseStyle = {
|
||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
...style,
|
...style,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user