fix(tui): check for selected text instead of any selection in dialog escape handler#16779
Open
altendky wants to merge 1 commit intoanomalyco:devfrom
Open
fix(tui): check for selected text instead of any selection in dialog escape handler#16779altendky wants to merge 1 commit intoanomalyco:devfrom
altendky wants to merge 1 commit intoanomalyco:devfrom
Conversation
…escape handler renderer.getSelection() returns a non-null Selection object from a simple click on selectable text (no drag needed). This blocks Escape from dismissing dialogs opened via mouse click. Use getSelectedText() to only block Escape when there is actual text selected, matching the pattern already used in session/index.tsx.
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #16778. May also fix #15202 and #14590.
Type of change
What does this PR do?
PR #13315 added a selection guard to the dialog escape handler at
dialog.tsx:73that checksrenderer.getSelection(). When clicking on selectable text (e.g. a user message), opentui creates aSelectionobject onmouseDowneven for a simple click with no drag. This empty selection lingers after the dialog opens onmouseUp, sogetSelection()returns a non-null object with no actual text — blocking Escape indefinitely.One-line fix:
renderer.getSelection()→renderer.getSelection()?.getSelectedText(), so Escape is only blocked when there is actual selected text. This matches the existing pattern at:session/index.tsx:1133session/index.tsx:1672session/index.tsx:1742How did you verify your code works?
Manually tested: opened Message Actions dialog by clicking a user message, pressed Escape — dialog now dismisses immediately without needing to click or type first.
Screenshots / recordings
No UI changes — keyboard behavior only.
Checklist