Skip to content

Comments

fix(tui): handle ESC to return to provider list rather than closing modal#14947

Open
ANSHSINGH050404 wants to merge 2 commits intoanomalyco:devfrom
ANSHSINGH050404:fix/provider-dialog-esc-navigation
Open

fix(tui): handle ESC to return to provider list rather than closing modal#14947
ANSHSINGH050404 wants to merge 2 commits intoanomalyco:devfrom
ANSHSINGH050404:fix/provider-dialog-esc-navigation

Conversation

@ANSHSINGH050404
Copy link

Issue for this PR

Closes #14931

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When adding a provider, pressing ESC inside the API key input or authorization code dialog previously closed the entire provider modal stack.

This happened because the root <Dialog /> layout (dialog.tsx) was trapping the Escape key globally and popping the stack by default.

To fix this:

  1. I updated dialog.replace() to accept an optional onEscape handler. If the handler returns false, the root dialog skips its default closing behavior.
  2. I passed a custom onBack handler to the ApiMethod, CodeMethod, and AutoMethod views that pushes <DialogProvider /> back onto the view stack and halts the default closing behavior.

How did you verify your code works?

I ran the TUI (bun dev), opened the "Connect a provider" menu, selected a provider, and hit ESC while in the API key / Auth Code prompt. I verified that it successfully returned me to the provider list without closing the modal.

Screenshots / recordings

Before

opencode-1.mp4

After

opencode-2.mp4

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@ANSHSINGH050404
Copy link
Author

"Hi @palmamartin @vvarp @ndarilek — I've submitted this PR to fix the issue where the ESC key was closing the entire provider modal instead of navigating back.

@ndarilek
Copy link
Contributor

I'm going to start adding people who randomly CC me on issues to a list I spam on every single comment I make on any repo's issues. Ready to start getting spam for Godot, jj, and a bunch of other repos you have no commit rights on? Buckle up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Add ESC key navigation to return to provider list when connecting providers

2 participants