Files
HuangYuChuh-ComfyUI-LLMs-To…/web
科林_Cyril Pilgrim 11b94718a6 fix(ui): fundamentally fix ESC key listener lifecycle
Motivation:
ESC worked only on first open because the listener was registered inside the first-time DOM creation block. On close(), it was detached. On subsequent show() calls, the modal DOM already existed so the function returned early — the listener was NEVER re-attached.

Implementation:
Extracted listener management into two symmetric private methods: _attachEscListener() and _detachEscListener(). show() now calls _attachEscListener on EVERY open (both first-time and subsequent). _closeModal is stored as an instance method so it can be referenced on re-opens. closeModal() calls _detachEscListener() symmetrically. This pattern is leak-proof and correctly re-attaches on every modal activation.
2026-03-05 12:41:09 +08:00
..