Compare commits

...

3 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
b30bc321bc Fix _tabTapped method binding issue
Convert _tabTapped to arrow function to preserve this context when
passed to memoized function and used as event handler.

Co-authored-by: piitaya <5878303+piitaya@users.noreply.github.com>
2026-02-02 16:11:41 +00:00
copilot-swe-agent[bot]
502af40dc6 Fix back arrow in Bluetooth settings cycling through tabs
Modify hass-tabs-subpage to use navigate with replace: true for tab clicks.
This prevents tab changes from being added to browser history, ensuring the
back arrow goes directly to the previous panel instead of cycling through tabs.

Co-authored-by: piitaya <5878303+piitaya@users.noreply.github.com>
2026-02-02 16:08:13 +00:00
copilot-swe-agent[bot]
57f6b0f3ec Initial plan 2026-02-02 16:01:09 +00:00

View File

@@ -4,7 +4,7 @@ import { customElement, eventOptions, property, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
import memoizeOne from "memoize-one";
import { canShowPage } from "../common/config/can_show_page";
import { goBack } from "../common/navigate";
import { goBack, navigate } from "../common/navigate";
import { restoreScroll } from "../common/decorators/restore-scroll";
import type { LocalizeFunc } from "../common/translations/localize";
import "../components/ha-icon-button-arrow-prev";
@@ -72,7 +72,8 @@ class HassTabsSubpage extends LitElement {
_language,
_userData,
_narrow,
localizeFunc
localizeFunc,
tabTappedHandler
) => {
const shownTabs = tabs.filter((page) => canShowPage(this.hass, page));
@@ -88,7 +89,7 @@ class HassTabsSubpage extends LitElement {
return shownTabs.map(
(page) => html`
<a href=${page.path}>
<a href=${page.path} @click=${tabTappedHandler}>
<ha-tab
.hass=${this.hass}
.active=${page.path === activeTab?.path}
@@ -127,7 +128,8 @@ class HassTabsSubpage extends LitElement {
this.hass.language,
this.hass.userData,
this.narrow,
this.localizeFunc || this.hass.localize
this.localizeFunc || this.hass.localize,
this._tabTapped
);
const showTabs = tabs.length > 1;
return html`
@@ -210,6 +212,12 @@ class HassTabsSubpage extends LitElement {
goBack();
}
private _tabTapped = (ev: Event): void => {
ev.preventDefault();
const anchor = ev.currentTarget as HTMLAnchorElement;
navigate(anchor.href, { replace: true });
};
static get styles(): CSSResultGroup {
return [
haStyleScrollbar,