Skip to content

Commit

Permalink
[Tooltip] Refactor touch handling
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Oct 16, 2020
1 parent a92256e commit 216fac6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/material-ui/src/Tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,17 +377,14 @@ const Tooltip = React.forwardRef(function Tooltip(props, ref) {
}, leaveDelay);
};

const detectTouchStart = (event) => {
const handleTouchStart = (event) => {
ignoreNonTouchEvents.current = true;

const childrenProps = children.props;
if (childrenProps.onTouchStart) {
childrenProps.onTouchStart(event);
}
};

const handleTouchStart = (event) => {
detectTouchStart(event);
clearTimeout(leaveTimer.current);
clearTimeout(closeTimer.current);
clearTimeout(touchTimer.current);
Expand Down Expand Up @@ -472,7 +469,6 @@ const Tooltip = React.forwardRef(function Tooltip(props, ref) {
...other,
...children.props,
className: clsx(other.className, children.props.className),
onTouchStart: detectTouchStart,
ref: handleRef,
...(followCursor ? { onMouseMove: handleMouseMove } : {}),
};
Expand Down

0 comments on commit 216fac6

Please sign in to comment.