Skip to content

Commit

Permalink
[IconMenu] doc for touchTapCloseDelay
Browse files Browse the repository at this point in the history
  • Loading branch information
cgestes committed Jul 7, 2015
1 parent 9e2e7ab commit 4e2ec72
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions docs/src/app/components/pages/components/icon-menus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ class IconMenus extends React.Component {
desc: 'Sets the width of the menu. If not specified, the menu width ' +
'will be dictated by its children. The rendered width will always be ' +
'a keyline increment (64px for desktop, 56px otherwise).'
},
{
name: 'touchTapCloseDelay',
type: 'number',
header: 'default: 200',
desc: 'Sets the delay in milliseconds before closing the menu when an item is clicked.'
}
]
},
Expand Down
8 changes: 4 additions & 4 deletions src/menus/icon-menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ let IconMenu = React.createClass({
onItemKeyboardActivate: React.PropTypes.func,
onItemTouchTap: React.PropTypes.func,
menuStyle: React.PropTypes.object,
timeout: React.PropTypes.number
touchTapCloseDelay: React.PropTypes.number
},

getDefaultProps() {
return {
openDirection: 'bottom-left',
onItemKeyboardActivate: () => {},
onItemTouchTap: () => {},
timeout: 200
touchTapCloseDelay: 200
};
},

Expand All @@ -47,7 +47,7 @@ let IconMenu = React.createClass({

componentWillUnmount() {
if (this._timeout)
clearTimeout(this.timeout);
clearTimeout(this._timeout);
},

componentClickAway() {
Expand Down Expand Up @@ -133,7 +133,7 @@ let IconMenu = React.createClass({
_handleItemTouchTap(e, child) {
this._timeout = setTimeout(() => {
this.close();
}, this.props.timeout);
}, this.props.touchTapCloseDelay);
if (Events.isKeyboard(e)) {
this.refs[this.state.iconButtonRef].setKeyboardFocus();
}
Expand Down

0 comments on commit 4e2ec72

Please sign in to comment.