feat: focus the target embedded chat when a button delivers a prompt - #371
Merged
Conversation
📝 WalkthroughWalkthroughEmbedded prompt delivery now focuses the resolved existing chat view, and the embeddable-block documentation describes the associated scroll and input-focus behavior. ChangesEmbedded chat focus
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Description
Agent buttons with
viewType: embeddeddelivered the prompt to the nearest chat block but did nothing visually — every other viewType opens, reveals, and focuses its target. In a long note with the block off-screen, clicking the button looked like nothing happened, even though the prompt had landed in the (invisible) block.The embedded branch of
runPromptInChatnow focuses the resolved target before delivery, reusing the containerfocus()— the same path the Session Manager uses — which scrolls to the block and focuses its input (and fronts the host tab when needed). All of its failure paths degrade silently to the previous deliver-only behavior. TheviewType: embeddeddoc tip mentions the scrolling now.If someone later wants delivery without the scroll jump, an opt-out fence option can gate this single call — deliberately not added until requested.
Related issue
None.
Type of change
Checklist
npm run lintpasses ("Use sentence case for UI text" warnings are acceptable for brand names)npm run buildpassesTesting environment
Screenshots
N/A
Summary by CodeRabbit
Bug Fixes
Documentation