Skip to content

Commit

Permalink
Ignore erroneous tap events (#1079)
Browse files Browse the repository at this point in the history
Ignore erroneous tap events that occasionally get sent on iOS and iPadOS after user finishes interacting with the slider.
  • Loading branch information
leongersen authored Jun 27, 2020
2 parents 6f945ab + 0fb0396 commit ef9bf78
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/nouislider.js
Original file line number Diff line number Diff line change
Expand Up @@ -1865,6 +1865,13 @@

// Move closest handle to tapped location.
function eventTap(event) {
// Erroneous events seem to be passed in occasionally on iOS/iPadOS after user finishes interacting with
// the slider. They appear to be of type MouseEvent, yet they don't have usual properties set. Ignore tap
// events that have no touches or buttons associated with them.
if (!event.buttons && !event.touches) {
return false;
}

// The tap event shouldn't propagate up
event.stopPropagation();

Expand Down

0 comments on commit ef9bf78

Please sign in to comment.