From c9ee0c8957db48337f36cc2a1daeb66c67350c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Pereira=20Mu=C3=B1oz?= Date: Sat, 22 Nov 2025 02:02:54 +0000 Subject: [PATCH 1/3] fix: hide sidebar tooltip on touchend events --- src/components/ha-sidebar.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/ha-sidebar.ts b/src/components/ha-sidebar.ts index 108a9450cf93..deb4affd4257 100644 --- a/src/components/ha-sidebar.ts +++ b/src/components/ha-sidebar.ts @@ -197,6 +197,8 @@ class HaSidebar extends SubscribeMixin(LitElement) { private _mouseLeaveTimeout?: number; + private _touchendTimeout?: number; + private _tooltipHideTimeout?: number; private _recentKeydownActiveUntil = 0; @@ -406,6 +408,7 @@ class HaSidebar extends SubscribeMixin(LitElement) { class="ha-scrollbar" @focusin=${this._listboxFocusIn} @focusout=${this._listboxFocusOut} + @touchend=${this._listboxTouchend} @scroll=${this._listboxScroll} @keydown=${this._listboxKeydown} > @@ -620,6 +623,13 @@ class HaSidebar extends SubscribeMixin(LitElement) { this._hideTooltip(); } + private _listboxTouchend() { + clearTimeout(this._touchendTimeout); + this._touchendTimeout = window.setTimeout(() => { + this._hideTooltip(); + }, 1000); + } + @eventOptions({ passive: true, }) From 99b6ac1e4bc7e85423993131cd2810b4fd43d6e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Pereira=20Mu=C3=B1oz?= Date: Mon, 24 Nov 2025 22:33:51 +0000 Subject: [PATCH 2/3] Add a comment recommended by Copilot --- src/components/ha-sidebar.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/ha-sidebar.ts b/src/components/ha-sidebar.ts index deb4affd4257..f464e4d56e32 100644 --- a/src/components/ha-sidebar.ts +++ b/src/components/ha-sidebar.ts @@ -626,6 +626,7 @@ class HaSidebar extends SubscribeMixin(LitElement) { private _listboxTouchend() { clearTimeout(this._touchendTimeout); this._touchendTimeout = window.setTimeout(() => { + // Allow 1 second for users to read the tooltip on touch devices this._hideTooltip(); }, 1000); } From 1de71925b37a411fe78255a70251ac18ca6d4042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Pereira=20Mu=C3=B1oz?= Date: Wed, 26 Nov 2025 17:49:46 +0000 Subject: [PATCH 3/3] Clear timeouts id in disconnectedCallback --- src/components/ha-sidebar.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/ha-sidebar.ts b/src/components/ha-sidebar.ts index f464e4d56e32..e73074c59cf7 100644 --- a/src/components/ha-sidebar.ts +++ b/src/components/ha-sidebar.ts @@ -239,6 +239,18 @@ class HaSidebar extends SubscribeMixin(LitElement) { ]; } + public disconnectedCallback() { + super.disconnectedCallback(); + // clear timeouts + clearTimeout(this._mouseLeaveTimeout); + clearTimeout(this._tooltipHideTimeout); + clearTimeout(this._touchendTimeout); + // set undefined values + this._mouseLeaveTimeout = undefined; + this._tooltipHideTimeout = undefined; + this._touchendTimeout = undefined; + } + protected render() { if (!this.hass) { return nothing;