mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-31 02:26:50 +10:00
Fix onBlur for externally controlled menus
This commit is contained in:
parent
a0ff57705d
commit
f31db35808
1 changed files with 7 additions and 1 deletions
|
|
@ -65,7 +65,13 @@ class Menu extends Component {
|
|||
// FocusEvent is fired faster than the link elements native click handler
|
||||
// gets its own event. Therefore, we need to check the origin of this FocusEvent.
|
||||
if (!this.menu.contains(event.relatedTarget)) {
|
||||
this.setState({ isOpen: false });
|
||||
const { isOpen, onToggleActive } = this.props;
|
||||
|
||||
if (isControlledMenu(isOpen, onToggleActive)) {
|
||||
onToggleActive(false);
|
||||
} else {
|
||||
this.setState({ isOpen: false });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue