Skip to content

Commit

Permalink
Dont handle touch if we already handle pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Oct 15, 2020
1 parent faaba7e commit 481a60c
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions packages/material-ui/src/Tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,27 +387,31 @@ const Tooltip = React.forwardRef(function Tooltip(props, ref) {
};

const handleTouchStart = (event) => {
detectTouchStart(event);
clearTimeout(leaveTimer.current);
clearTimeout(closeTimer.current);
clearTimeout(touchTimer.current);
event.persist();
touchTimer.current = setTimeout(() => {
handleEnter()(event);
}, enterTouchDelay);
if (typeof PointerEvent === 'undefined') {
detectTouchStart(event);
clearTimeout(leaveTimer.current);
clearTimeout(closeTimer.current);
clearTimeout(touchTimer.current);
event.persist();
touchTimer.current = setTimeout(() => {
handleEnter()(event);
}, enterTouchDelay);
}
};

const handleTouchEnd = (event) => {
if (children.props.onTouchEnd) {
children.props.onTouchEnd(event);
}

clearTimeout(touchTimer.current);
clearTimeout(leaveTimer.current);
event.persist();
leaveTimer.current = setTimeout(() => {
handleClose(event);
}, leaveTouchDelay);
if (typeof PointerEvent === 'undefined') {
clearTimeout(touchTimer.current);
clearTimeout(leaveTimer.current);
event.persist();
leaveTimer.current = setTimeout(() => {
handleClose(event);
}, leaveTouchDelay);
}
};

React.useEffect(() => {
Expand Down

0 comments on commit 481a60c

Please sign in to comment.