mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-22 00:36:34 +00:00
Hopefully fix some back button issues (#8708)
This commit is contained in:
parent
742028b691
commit
7f7d89c745
@ -36,11 +36,11 @@ class DialogBox extends LitElement {
|
|||||||
|
|
||||||
public closeDialog(): boolean {
|
public closeDialog(): boolean {
|
||||||
if (this._params?.confirmation || this._params?.prompt) {
|
if (this._params?.confirmation || this._params?.prompt) {
|
||||||
this._dismiss();
|
return false;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
if (this._params) {
|
if (this._params) {
|
||||||
return false;
|
this._dismiss();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ class DialogBox extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _dialogClosed(ev) {
|
private _dialogClosed(ev) {
|
||||||
if (this._params?.prompt && ev.detail.action === "ignore") {
|
if (ev.detail.action === "ignore") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._dismiss();
|
this._dismiss();
|
||||||
|
@ -186,7 +186,7 @@ class HassTabsSubpage extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _tabTapped(ev: Event): void {
|
private _tabTapped(ev: Event): void {
|
||||||
navigate(this, (ev.currentTarget as any).path, true);
|
navigate(this, (ev.currentTarget as any).path);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _backTapped(): void {
|
private _backTapped(): void {
|
||||||
@ -230,7 +230,6 @@ class HassTabsSubpage extends LitElement {
|
|||||||
padding: 0 16px;
|
padding: 0 16px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tabbar {
|
#tabbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
@ -40,6 +40,12 @@ export const urlSyncMixin = <
|
|||||||
) => {
|
) => {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log("dialog closed", ev.detail.dialog);
|
console.log("dialog closed", ev.detail.dialog);
|
||||||
|
console.log(
|
||||||
|
"open",
|
||||||
|
history.state?.open,
|
||||||
|
"dialog",
|
||||||
|
history.state?.dialog
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// If not closed by navigating back, and not a new dialog is open, remove the open state from history
|
// If not closed by navigating back, and not a new dialog is open, remove the open state from history
|
||||||
if (
|
if (
|
||||||
@ -56,8 +62,11 @@ export const urlSyncMixin = <
|
|||||||
|
|
||||||
private _popstateChangeListener = (ev: PopStateEvent) => {
|
private _popstateChangeListener = (ev: PopStateEvent) => {
|
||||||
if (this._ignoreNextPopState) {
|
if (this._ignoreNextPopState) {
|
||||||
if (ev.state?.oldState?.replaced) {
|
if (
|
||||||
// if the previous dialog was replaced, and the current dialog is closed, we should also remove the replaced dialog from history
|
ev.state?.oldState?.replaced ||
|
||||||
|
ev.state?.oldState?.dialogParams === null
|
||||||
|
) {
|
||||||
|
// if the previous dialog was replaced, or we could not copy the params, and the current dialog is closed, we should also remove the previous dialog from history
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log("remove old state", ev.state.oldState);
|
console.log("remove old state", ev.state.oldState);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user