Skip to content

Conversation

@michelroegl-brunner
Copy link
Member

Implements a global ESC-to-close behavior across custom modals.

Key points:

  • Adds ModalStackProvider with a single keydown listener to close the topmost eligible modal.
  • Allows ESC even when typing in inputs (per user request).
  • Protects destructive/critical flows: danger ConfirmationModal, AuthModal, LoadingModal are not dismissible via ESC.
  • Wires all modals to register/unregister with the stack, providing allowEscape and onClose.
  • Wrapped app in provider in src/app/layout.tsx.
  • Fixed lint issues and ensured successful build (npm run build passes).

Testing:

  • Open any non-critical modal and press ESC: closes.
  • Focus an input inside any non-critical modal and press ESC: closes.
  • Open danger confirmation, auth or loading modals and press ESC: no effect.
  • When multiple modals open, ESC only closes the topmost eligible modal.

… modals; keep danger/auth/loading protected; allow ESC even when typing; fix lint
@michelroegl-brunner michelroegl-brunner requested a review from a team as a code owner October 20, 2025 12:44
@michelroegl-brunner michelroegl-brunner changed the title Add global Escape-to-close for custom modals fix/194 Add global Escape-to-close for custom modals Oct 20, 2025
@michelroegl-brunner michelroegl-brunner merged commit ec38ab9 into main Oct 20, 2025
4 checks passed
@michelroegl-brunner michelroegl-brunner deleted the feat/global-esc-close branch November 13, 2025 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants