Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
caub committed Feb 15, 2018
1 parent 79ba5db commit 895d53a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docs/src/pages/demos/menus/MenuListComposition.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import ClickAwayListener from 'material-ui/utils/ClickAwayListener';
const styles = {
root: {
display: 'flex',
'&> *': {
margin: '0 1em',
},
},
popperClose: {
pointerEvents: 'none',
Expand All @@ -23,6 +26,10 @@ class MenuListComposition extends React.Component {
open: false,
};

componentWillUnmount() {
clearTimeout(this.timeout);
}

handleClick = () => {
this.setState({ open: !this.state.open }); // toggle dropdown
};
Expand All @@ -32,7 +39,7 @@ class MenuListComposition extends React.Component {
return;
}
// setTimeout to ensure a close event comes after a target click event
setTimeout(() => {
this.timeout = setTimeout(() => {
this.setState({ open: false });
});
};
Expand All @@ -57,7 +64,7 @@ class MenuListComposition extends React.Component {
aria-haspopup="true"
onClick={this.handleClick}
>
Open Menu
Toggle Menu
</Button>
</Target>
<Popper
Expand Down

0 comments on commit 895d53a

Please sign in to comment.