Skip to content

Commit

Permalink
fix: remove touch-action handling (#28)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The Draggable no longer sets touch action none. Preventing the default action should be handled by the user
  • Loading branch information
danielkaradachki authored Jun 14, 2019
1 parent e8b7b54 commit 41498ba
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
18 changes: 0 additions & 18 deletions e2e/draggable.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ describe('Draggable with Pointer events', () => {

expect(handler).toHaveBeenCalledTimes(1);
});

it("sets touch-action to none on pointerdown", () => {
pointerdown(el, 100, 200);
expect(el.style.touchAction).toEqual('none');
});
});

describe("Drag", () => {
Expand Down Expand Up @@ -226,19 +221,6 @@ describe('Draggable with Pointer events', () => {
expect(handler).not.toHaveBeenCalled();
});

it("restores auto touch-action on pointerup", () => {
pointerdown(el, 100, 200);
pointerup(el, 100, 200);
expect(el.style.touchAction).toEqual('');
});

it("restores previous touch-action on pointerup", () => {
el.style.touchAction = 'pan-y';
pointerdown(el, 100, 200);
pointerup(el, 100, 200);
expect(el.style.touchAction).toEqual('pan-y');
});

});

describe("with mouseOnly set to true", () => {
Expand Down
6 changes: 0 additions & 6 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export class Draggable {
this._releaseHandler = proxy(normalizeEvent, release);
this._ignoreMouse = false;
this._mouseOnly = mouseOnly;
this._touchAction;

this._touchstart = (e) => {
if (e.touches.length === 1) {
Expand Down Expand Up @@ -112,9 +111,6 @@ export class Draggable {
bind(document, "pointercancel", this._pointerup);
bind(document, "contextmenu", preventDefault);

this._touchAction = e.target.style.touchAction;
e.target.style.touchAction = "none";

this._pressHandler(e);
}
};
Expand All @@ -132,8 +128,6 @@ export class Draggable {
unbind(document, "pointercancel", this._pointerup);
unbind(document, "contextmenu", preventDefault);

e.target.style.touchAction = this._touchAction;

this._releaseHandler(e);
}
};
Expand Down

0 comments on commit 41498ba

Please sign in to comment.