Skip to content

feat: focus the target embedded chat when a button delivers a prompt - #371

Merged
RAIT-09 merged 1 commit into
devfrom
feat/embedded-button-focus
Jul 17, 2026
Merged

feat: focus the target embedded chat when a button delivers a prompt#371
RAIT-09 merged 1 commit into
devfrom
feat/embedded-button-focus

Conversation

@RAIT-09

@RAIT-09 RAIT-09 commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Description

Agent buttons with viewType: embedded delivered 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 runPromptInChat now focuses the resolved target before delivery, reusing the container focus() — 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. The viewType: embedded doc 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

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other

Checklist

  • npm run lint passes ("Use sentence case for UI text" warnings are acceptable for brand names)
  • npm run build passes
  • Tested in Obsidian
  • Existing functionality still works
  • Documentation updated if needed

Testing environment

  • Agent: Claude Code. Verified: off-screen block scrolls into view with input focused and prompt delivered (with and without autoSend); short notes focus without excessive jumping; no-block notes still show only the notice; other viewTypes and Session Manager focusing unchanged
  • OS: macOS

Screenshots

N/A

Summary by CodeRabbit

  • Bug Fixes

    • Embedded chat prompts now bring the nearest existing chat block into view and focus its input automatically, making it easier to continue typing immediately.
  • Documentation

    • Updated embedded block guidance to explain that prompts target the nearest existing chat block and that the interface scrolls to and focuses the selected block.

@RAIT-09 RAIT-09 self-assigned this Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Embedded prompt delivery now focuses the resolved existing chat view, and the embeddable-block documentation describes the associated scroll and input-focus behavior.

Changes

Embedded chat focus

Layer / File(s) Summary
Prompt focus and documentation
src/plugin.ts, docs/usage/embeddable-blocks.md
Embedded prompt delivery focuses the resolved target view, while the usage tip documents scrolling to the existing chat block and focusing its input.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: donivatamazondotcom, maws7140

Poem

A rabbit hops where chat blocks hide,
Finds the nearest one inside.
The prompt arrives, the view gains sight,
It scrolls and focuses—just right!
“Now type away,” the bunny cheers.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: focusing the target embedded chat when delivering a prompt.
Description check ✅ Passed The description follows the template and includes the required sections with sufficiently detailed change, testing, and environment information.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/embedded-button-focus

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@RAIT-09
RAIT-09 merged commit fad4f2b into dev Jul 17, 2026
2 checks passed
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.

1 participant