Skip to content

Commit

Permalink
[docs] fix example with react-popper to allow toggling
Browse files Browse the repository at this point in the history
closes #10297
  • Loading branch information
caub committed Feb 14, 2018
1 parent e038614 commit 79ba5db
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/src/pages/demos/menus/MenuListComposition.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,17 @@ class MenuListComposition extends React.Component {
};

handleClick = () => {
this.setState({ open: true });
this.setState({ open: !this.state.open }); // toggle dropdown
};

handleClose = () => {
this.setState({ open: false });
if (!this.state.open) {
return;
}
// setTimeout to ensure a close event comes after a target click event
setTimeout(() => {
this.setState({ open: false });
});
};

render() {
Expand Down

0 comments on commit 79ba5db

Please sign in to comment.