Skip to content

Commit

Permalink
prevent touch scroll from bubbling
Browse files Browse the repository at this point in the history
  • Loading branch information
janikoskela committed Feb 25, 2015
1 parent 2c78771 commit 89496da
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/dist/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,8 @@ SELECT.ELEMENTS.WIDGET.SubWrapper.prototype = Object.create(SELECT.ELEMENTS.Elem
});
this.element.addEventListener("keyup", onKeyUp.bind(this));
this.element.addEventListener("keydown", onKeyDown.bind(this));
this.element.addEventListener("touchmove", touchScroll.bind(this));
this.element.addEventListener("scroll", touchScroll.bind(this));

var widgetSubWrapper = Facade.subscribe("WidgetSubWrapper", new SELECT.ELEMENTS.WIDGET.SubWrapper(Facade));
var widgetSubWrapperElem = widgetSubWrapper.render();
Expand All @@ -1446,6 +1448,11 @@ SELECT.ELEMENTS.WIDGET.SubWrapper.prototype = Object.create(SELECT.ELEMENTS.Elem
this.element.setAttribute("tabindex", this.tabIndex);
}

function touchScroll(e) {
e.stopPropagation();
return false;
}

function onKeyDown(e) {
if (this.locked === true)
return;
Expand Down
2 changes: 1 addition & 1 deletion src/dist/select.min.js

Large diffs are not rendered by default.

Binary file modified src/dist/select.min.js.gz
Binary file not shown.
7 changes: 7 additions & 0 deletions src/select/elements/widget/WidgetWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ SELECT.ELEMENTS.WIDGET.Wrapper = function(Facade) {
});
this.element.addEventListener("keyup", onKeyUp.bind(this));
this.element.addEventListener("keydown", onKeyDown.bind(this));
this.element.addEventListener("touchmove", touchScroll.bind(this));
this.element.addEventListener("scroll", touchScroll.bind(this));

var widgetSubWrapper = Facade.subscribe("WidgetSubWrapper", new SELECT.ELEMENTS.WIDGET.SubWrapper(Facade));
var widgetSubWrapperElem = widgetSubWrapper.render();
Expand All @@ -54,6 +56,11 @@ SELECT.ELEMENTS.WIDGET.Wrapper = function(Facade) {
this.element.setAttribute("tabindex", this.tabIndex);
}

function touchScroll(e) {
e.stopPropagation();
return false;
}

function onKeyDown(e) {
if (this.locked === true)
return;
Expand Down

0 comments on commit 89496da

Please sign in to comment.