HTML5 Canvas Mobile Scrolling and Native Events with Konva

By default Konva will prevent default behaviour off all pointer interactions with a stage.
That will prevent unexpected scrolling of a page when you are trying to drag&drop a shape on a mobile device.

But in some cases you may want to keep default behaviour of browser events. In that case you may set preventDefault property of a shape to false.

Instructions: if you are on mobile device try to scroll a page by each rectangle.
Green - should prevent default behaviour (no page scrolling).
Red - will keep default behaviour (scrolling should work).

Konva Mobile Scrolling Demoview raw
<!DOCTYPE html>
<script src="[email protected]/konva.min.js"></script>
<meta charset="utf-8" />
<title>Konva Mobile Scrolling and Native Events Demo</title>
body {
margin: 0;
padding: 0;
overflow: hidden;
background-color: #f0f0f0;
<div id="container"></div>
var width = window.innerWidth;
var height = window.innerHeight;

var stage = new Konva.Stage({
container: 'container',
width: width,
height: height,

var layer = new Konva.Layer();

var defaultBehaviourRect = new Konva.Rect({
width: 100,
height: 100,
fill: 'green',

var noPreventDefaultRect = new Konva.Rect({
x: 200,
y: 50,
width: 100,
height: 100,
fill: 'red',
preventDefault: false,


// add the layer to the stage
Enjoying Konva? Please consider to support the project.