Skip to content
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
23 changes: 23 additions & 0 deletions src/components/ha-sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ class HaSidebar extends SubscribeMixin(LitElement) {

private _mouseLeaveTimeout?: number;

private _touchendTimeout?: number;

private _tooltipHideTimeout?: number;

private _recentKeydownActiveUntil = 0;
Expand Down Expand Up @@ -237,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;
Expand Down Expand Up @@ -406,6 +420,7 @@ class HaSidebar extends SubscribeMixin(LitElement) {
class="ha-scrollbar"
@focusin=${this._listboxFocusIn}
@focusout=${this._listboxFocusOut}
@touchend=${this._listboxTouchend}
@scroll=${this._listboxScroll}
@keydown=${this._listboxKeydown}
>
Expand Down Expand Up @@ -620,6 +635,14 @@ class HaSidebar extends SubscribeMixin(LitElement) {
this._hideTooltip();
}

private _listboxTouchend() {
clearTimeout(this._touchendTimeout);
this._touchendTimeout = window.setTimeout(() => {
// Allow 1 second for users to read the tooltip on touch devices
this._hideTooltip();
}, 1000);
}

@eventOptions({
passive: true,
})
Expand Down
Loading