Skip to content

Commit

Permalink
feat(tooltip): don't show tooltip on touch
Browse files Browse the repository at this point in the history
This is the more sensible default behavior
  • Loading branch information
tobyzerner committed Oct 12, 2023
1 parent f842b6d commit c8998bc
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ export default class TooltipElement extends HTMLElement {
private onFocus = this.show.bind(this);
private onMouseLeave = this.afterDelay.bind(this, this.hide);
private onBlur = this.hide.bind(this);
private onPointerUp = (e: PointerEvent) => {
if (e.pointerType === 'mouse') this.hide();
else this.show();
};

public connectedCallback(): void {
this.parent = this.parentNode as HTMLElement;
Expand All @@ -31,7 +27,7 @@ export default class TooltipElement extends HTMLElement {
this.parent.addEventListener('focus', this.onFocus);
this.parent.addEventListener('mouseleave', this.onMouseLeave);
this.parent.addEventListener('blur', this.onBlur);
this.parent.addEventListener('pointerup', this.onPointerUp);
this.parent.addEventListener('click', this.onBlur);

this.disabledObserver = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
Expand Down Expand Up @@ -61,7 +57,7 @@ export default class TooltipElement extends HTMLElement {
this.parent.removeEventListener('focus', this.onFocus);
this.parent.removeEventListener('mouseleave', this.onMouseLeave);
this.parent.removeEventListener('blur', this.onBlur);
this.parent.removeEventListener('pointerup', this.onPointerUp);
this.parent.removeEventListener('click', this.onBlur);
this.parent = undefined;
}

Expand Down

0 comments on commit c8998bc

Please sign in to comment.