Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tap-click): activated state is kept on activable element #13258

Merged
merged 2 commits into from
Oct 27, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/tap-click/tap-click.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class TapClick {
private usePolyfill: boolean;
private activator: ActivatorBase;
private startCoord: any;
private activatableEle: HTMLElement;
private events: UIEventManager;
private pointerEvents: PointerEvents;
private lastTouchEnd: number;
Expand Down Expand Up @@ -77,14 +78,14 @@ export class TapClick {
return true;
}

let activatableEle = getActivatableTarget(ev.target);
if (!activatableEle) {
this.activatableEle = getActivatableTarget(ev.target);
if (!this.activatableEle) {
this.startCoord = null;
return false;
}

this.startCoord = pointerCoord(ev);
this.activator && this.activator.downAction(ev, activatableEle, this.startCoord);
this.activator && this.activator.downAction(ev, this.activatableEle, this.startCoord);
return true;
}

Expand All @@ -103,7 +104,7 @@ export class TapClick {
return;
}
if (this.activator && ev.target !== this.plt.doc()) {
let activatableEle = getActivatableTarget(ev.target);
let activatableEle = getActivatableTarget(ev.target) || this.activatableEle;
if (activatableEle) {
this.activator.upAction(ev, activatableEle, this.startCoord);
}
Expand All @@ -112,12 +113,14 @@ export class TapClick {
this.handleTapPolyfill(ev);
}
this.startCoord = null;
this.activatableEle = null;
}

pointerCancel(ev: UIEvent) {
console.debug(`pointerCancel from ${ev.type} ${Date.now()}`);

this.startCoord = null;
this.activatableEle = null;
this.dispatchClick = false;
this.activator && this.activator.clearState(false);
this.pointerEvents.stop();
Expand Down