Skip to content

Commit efeb8a2

Browse files
committed
Further clarification of touch events
1 parent 7a8d1e0 commit efeb8a2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

15_event.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,13 @@ touching finger.
575575
</script>
576576
```
577577

578+
{{index "preventDefault method"}}
579+
580+
You'll usually want to call `preventDefault` in touch event handlers,
581+
to override the browser's default behavior (which may include
582+
scrolling the page on swiping) and to prevent the mouse events from
583+
being fired, for which you may also have registered a handler.
584+
578585
## Scroll events
579586

580587
{{index scrolling, "scroll event", "event handling"}}
@@ -929,7 +936,8 @@ prevent the browser's default handling of the event
929936

930937
Pressing a key fires `"keydown"` and `"keyup"` events. Pressing a
931938
mouse button fires `"mousedown"`, `"mouseup"`, and `"click"` events.
932-
Moving the mouse fires `"mousemove"` events.
939+
Moving the mouse fires `"mousemove"` events. Touchscreen interaction
940+
will result in `"touchstart"`, `"touchmove"`, and `"touchend"` events.
933941

934942
Scrolling can be detected with the `"scroll"` event, and focus changes
935943
can be detected with the `"focus"` and `"blur"` events. When the

0 commit comments

Comments
 (0)