From ea10d1a634a1b50e1e494a90fe9bb8b00f8440b2 Mon Sep 17 00:00:00 2001 From: Dermot Duffy Date: Sun, 10 Apr 2022 09:04:11 -0700 Subject: [PATCH] Don't display tooltips on touch only devices. --- src/components/timeline.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/timeline.ts b/src/components/timeline.ts index 5b8e6f75..f7802cf9 100644 --- a/src/components/timeline.ts +++ b/src/components/timeline.ts @@ -66,6 +66,10 @@ interface TimelineViewContext extends ViewContext { type TimelineMediaType = 'all' | 'clips' | 'snapshots'; +const isHoverableDevice = window.matchMedia( + '(hover: hover) and (pointer: fine)' +) + /** * A manager to maintain/fetch timeline events. */ @@ -375,6 +379,12 @@ export class FrigateCardTimelineCore extends LitElement { * @returns The tooltip as a string to render. */ protected _getTooltip(source: FrigateBrowseMediaSource): string { + if (!isHoverableDevice.matches) { + // Don't display tooltips on touch devices, they just get in the way of + // the drawer. + return ''; + } + const thumbnailSizeAttr = this.timelineConfig ? `thumbnail_size="${this.timelineConfig.controls.thumbnails.size}"` : '';