Comfy-Org / Comfy-Org/ComfyUI

ComfyUI‑desktop Feature Request – Safe Back‑Button Handling

Open
#8,707 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

> Pressing a mouse **Back** button in ComfyUI‑desktop currently dumps users into a permanent **“Loading…”** screen (see screenshot). The same mis‑behaviour occurs when a queued image is in full‑screen preview. This wipes the working context and forces a manual reload of the app.

## 1 · Summary

**Requested changes**

1. **Ignore** the Back button while editing or previewing, so it *never* navigates the Electron history stack.
2. **If** a queued image is open in full‑screen, treat Back **exactly like **`` – close the overlay and return to the queue list *without* triggering the Loading screen.

---

## 2 · Motivation

| Pain Point | Impact |
| --------------------------------------------------- | --------------------------------- |
| **Accidental exile** – side buttons are easy to hit | Lost graphs & wasted time |
| **Inconsistent modal dismissal** | Frustration + broken mental model |
| **Desktop context** – no visible history bar | User can’t simply click *Forward* |

---

## 3 · Expected Behaviour

| Context | Back‑button action | Equivalent to |
| ---------------------------- | -------------------------------------------- | ------------- |
| **Editing canvas** | No‑op *(or optional unsaved‑changes prompt)* | – |
| **Full‑screen queued image** | Close overlay → return to queue | `Esc` key |

---

## 4 · Current Behaviour (Bug)

| Context | Result |
| ------------------------ | ------------------------------------------------------------- |
| Editing canvas | Electron navigates backward → **permanent “Loading…” screen** |
| Full‑screen queued image | Same undesired navigation → **permanent “Loading…” screen** |

**Screenshot of the stuck state:**

---

## 5 · Steps to Reproduce

1. **Open** **ComfyUI‑desktop** (`v0.4.53`, frontend `v1.23.3`, core `v0.3.42`) on Windows 11.
2. **Scenario A** – build or load any workflow → hit mouse Back button.
3. **Scenario B** – run a workflow → in **QUEUE**, click an image to full‑screen → hit mouse Back button.
4. Observe indefinite **“Loading…”** view (see screenshot above).

---

## 6 · Proposed Implementation Notes (pseudo‑code)

```javascript
// Electron/React front‑end
window.addEventListener("popstate", (ev) => {
if (isEditingCanvas()) {
ev.preventDefault(); // squash Back
} else if (isFullscreenPreview()) {
exitFullscreenPreview(); // mimic Esc
ev.preventDefault();
}
});
```

*Details*

- Push a synthetic history state when entering full‑screen so a single Back can cleanly close it.

![Image](https://github.com/user-attachments/assets/66772db0-6fdc-487b-9db8-2b6d92c74e61)

## 7 · Environment

| Component | Version |
| --------------- | ------------------------------------------- |
| ComfyUI core | **v0.3.42** |
| Front‑end | **v1.23.3** |
| Desktop wrapper | **v0.4.53** |
| OS | Windows 11 |
| Mouse | Side buttons mapped to Browser Back/Forward |

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.