Skip to content

Commit

Permalink
Removing touch event
Browse files Browse the repository at this point in the history
  • Loading branch information
yosilevy committed Feb 16, 2023
1 parent 5132f2e commit cd973e2
Showing 1 changed file with 5 additions and 22 deletions.
27 changes: 5 additions & 22 deletions src/group-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,11 @@ customElements.define(
this.fullyHideOtherGroupsOnShow = undefined;

// handle both tap and click since it's inconsistent in picture-element
this.addEventListener("click", (ev) => this.handleAction(ev, false));
this.addEventListener("touchstart", (ev) => this.handleAction(ev, true));
}

handleAction(ev, preventDefault){
// if click is on internal element and there are no elements in toggle area user asked to show - get out
// if there are - handle tap/toggle visibility
if (ev.target !== this && this._toggleAreaElements.length === 0) {
ev.stopPropagation();
return false;
}
this.toggleVisibility(
true,
this.fullyHideOtherGroupsOnShow !== undefined &&
this.fullyHideOtherGroupsOnShow
);

if(preventDefault)
ev.preventDefault();

ev.stopPropagation();
return false;
this.addEventListener("click", () => this.toggleVisibility(
true,
this.fullyHideOtherGroupsOnShow !== undefined &&
this.fullyHideOtherGroupsOnShow
));
}

setConfig(config) {
Expand Down

0 comments on commit cd973e2

Please sign in to comment.