Skip to content

[GEN-04] Profile bus uses global window keydown listener — Escape closes profile from anywhere #347

@intendednull

Description

@intendednull

Audit finding from #300 (commit 679f9fe)

Severity: medium
Category: ux
File: crates/web/src/profile/controller.rs:114
Obvious fix: yes

Description

install_listeners_once registers a window-level keydown listener that calls set_open.set(None) on every Escape, no matter the focused element or whether the profile card is open. This both consumes work and competes with other Escape handlers (search input, command palette, dialogs).

Impact / Threat

User-facing — Esc-to-cancel in other surfaces can race with this listener; benign for now but error-prone as more modals land.

Suggested fix

Only register the listener while a profile is open (drop / re-add it from an Effect), or guard with if profile_state.with(Option::is_some).

Verify

rg "keydown" crates/web/src/profile/controller.rs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions