|
|
@ -39,10 +39,9 @@ export default class MenuDroppoComponent extends Component { |
|
|
|
if ( |
|
|
|
if ( |
|
|
|
this.props.isOpen && |
|
|
|
this.props.isOpen && |
|
|
|
target !== container && |
|
|
|
target !== container && |
|
|
|
!isDescendant(this.container, event.target) && |
|
|
|
!this.container.contains(event.target) |
|
|
|
this.props.onClickOutside |
|
|
|
|
|
|
|
) { |
|
|
|
) { |
|
|
|
this.props.onClickOutside(event); |
|
|
|
this.props.onClickOutside?.(event); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -117,15 +116,3 @@ export default class MenuDroppoComponent extends Component { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function isDescendant(parent, child) { |
|
|
|
|
|
|
|
let node = child.parentNode; |
|
|
|
|
|
|
|
while (node !== null) { |
|
|
|
|
|
|
|
if (node === parent) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
node = node.parentNode; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|