Skip to content

Commit

Permalink
fix SpeedDials docs double click (#10713)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertLucianto authored and mbrookes committed Mar 19, 2018
1 parent a807ad1 commit 127d275
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/src/pages/lab/speed-dial/SpeedDials.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ class SpeedDials extends React.Component {
const { classes } = this.props;
const { hidden, open } = this.state;

let isTouch;
if (typeof document !== 'undefined') {
isTouch = 'ontouchstart' in document.documentElement;
}

return (
<div className={classes.root}>
<Button onClick={this.handleVisibility}>Toggle Speed Dial</Button>
Expand All @@ -78,8 +83,8 @@ class SpeedDials extends React.Component {
onBlur={this.handleClose}
onClick={this.handleClick}
onClose={this.handleClose}
onFocus={this.handleOpen}
onMouseEnter={this.handleOpen}
onFocus={isTouch ? undefined : this.handleOpen}
onMouseEnter={isTouch ? undefined : this.handleOpen}
onMouseLeave={this.handleClose}
open={open}
>
Expand Down

0 comments on commit 127d275

Please sign in to comment.