qpixel icon indicating copy to clipboard operation
qpixel copied to clipboard

Can ESC close modals?

Open cellio opened this issue 4 months ago • 3 comments

meta:293908

On some sites and in some applications, ESC closes modals, pop-ups, and similar things. We have a request for that in qpixel. I'm not sure what should happen if you have more than one "closable thing" open at the time; this requires more analysis.

cellio avatar Nov 05 '25 22:11 cellio

My intuitive expectation would be that Esc closes the currently active thing, if that's a closable thing, or its parent if that's a closable thing, and so on. So only one thing would be closed with each press, but multiple presses could close multiple things one at a time.

trichoplax avatar Nov 05 '25 22:11 trichoplax

We'd probably need to think carefully about false positives (closing things where the user intended Esc to do something else) in order to avoid losing work. For example, if dragging something to drop somewhere, and then changing their mind, a user can press Esc to avoid the thing being dropped somewhere they didn't intend (which would otherwise happen if they just released the mouse button rather than pressing Esc first). This should only terminate the dragging of the thing, not close any modals.

trichoplax avatar Nov 05 '25 22:11 trichoplax

Agreed -- making you click manually is much better than the risk of lost work. Needs more thought.

cellio avatar Nov 05 '25 22:11 cellio