Repository navigation
feat(browser): edit a page annotation's comment and intent inline in the tray - #17511
Merged
Merged
Conversation
…the tray Fixing a typo in a browser annotation required deleting it and re-picking the element in the page. Each tray row now has a hover-revealed edit button that swaps the row to an inline editor (comment textarea seeded with the current text, intent toggle, Save/Cancel), reusing the compose card's submit shortcut and length budget. Edits route through a new updateBrowserPageAnnotation store action that no-ops on a missing id and sanitizes the merged annotation exactly like the add path. Escape inside the editor cancels only the row edit: the annotate mode's window-level capture listener now exempts the edit container, since stopPropagation from a descendant cannot reach a capture listener. Editing is deliberately limited to comment and intent: element targets, cross-navigation persistence, and the prompt builder are untouched (the builder reads live off the array, so edited text flows through). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_017rEaTnSaSneEMEJvebzM53
Greptile SummaryThis PR adds inline editing for browser-page annotation comments and intents while preserving the selected page element.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/renderer/src/components/browser-pane/annotate/browser-page-annotation-tray.tsx | Adds a labeled inline editor with seeded state, validated save behavior, cancellation, and edit-state cleanup. |
| src/renderer/src/components/browser-pane/annotate/useGrabMode.ts | Exempts annotation editor descendants from the capture-phase Escape handler so the row can own cancellation. |
| src/renderer/src/components/browser-pane/annotate/use-browser-page-annotation-send.ts | Connects tray edits to the browser annotation store action and feature-interaction tracking. |
| src/renderer/src/store/slices/browser.ts | Adds an annotation update action that preserves strict no-op behavior for missing IDs and sanitizes merged values. |
| src/renderer/src/components/browser-pane/annotate/browser-page-annotation-tray.test.tsx | Covers editor seeding, trimmed saves, intent updates, cancellation, accessible control names, and Escape behavior. |
| src/renderer/src/components/browser-pane/annotate/useGrabMode.test.ts | Covers the editor-specific Escape exemption and preserves cancellation outside exempt containers. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Annotation tray row] -->|Edit| E[Inline editor]
E -->|Save comment and intent| H[Update handler]
H --> S[Browser store update]
S --> Z[Sanitize merged annotation]
Z --> T[Updated tray and generated feedback]
E -->|Cancel or Escape| A
G[Grab-mode capture listener] -->|Escape inside editor: exempt| E
Reviews (2): Last reviewed commit: "test(browser): pin the annotate-mode Esc..." | Re-trigger Greptile
Contributor
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline.
Reviewed changes
- Store action —
updateBrowserPageAnnotation(pageId, annotationId, patch)merges{ comment, intent }into the target annotation, runs the result through the existingsanitizeBrowserPageAnnotation, and returns the unchanged state reference when the id is missing (a strict no-op). - Inline row editor — the tray row swaps to a textarea + intent toggle + Save/Cancel; Save trims the comment and is disabled while empty, the screen-submit shortcut saves, Escape cancels, and a
useEffectdrops edit state when the annotation disappears mid-edit. - Escape exemption —
useGrabMode's window-level capture listener now bails out for[data-slot="annotation-edit"], so Escape inside the editor cancels only the row edit instead of tearing down the annotate session. - Wiring & i18n —
handleUpdateBrowserAnnotationis threaded through the shared overlay props (both browser pane and doc preview), plus four minted localization keys.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…edits The data-slot annotation-edit clause in useGrabMode's capture keydown listener had no test that dispatched a keydown through it, so deleting the clause left the suite green. These tests invoke the real registered capture handler with an Escape whose target sits inside (and outside) an annotation-edit container; the inside case uses a button, which isEditableKeyboardTarget does not cover, so only the exemption clause can keep grab mode alive. Removing the clause now fails the suite.
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Escape-exemption regression test — added a test that invokes the real capture-phase keydown handler with an Escape whose target sits inside a
[data-slot="annotation-edit"]container, pinning theuseGrabModeexemption against accidental removal. - Negative-path test — added a companion test confirming Escape from outside any exempt container still cancels grab mode.
- Test environment — switched the file to
happy-domand clearsdocument.bodyinafterEachto support the new DOM assertions.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
…the tray (stablyai#17511) * feat(browser): edit a page annotation's comment and intent inline in the tray Fixing a typo in a browser annotation required deleting it and re-picking the element in the page. Each tray row now has a hover-revealed edit button that swaps the row to an inline editor (comment textarea seeded with the current text, intent toggle, Save/Cancel), reusing the compose card's submit shortcut and length budget. Edits route through a new updateBrowserPageAnnotation store action that no-ops on a missing id and sanitizes the merged annotation exactly like the add path. Escape inside the editor cancels only the row edit: the annotate mode's window-level capture listener now exempts the edit container, since stopPropagation from a descendant cannot reach a capture listener. Editing is deliberately limited to comment and intent: element targets, cross-navigation persistence, and the prompt builder are untouched (the builder reads live off the array, so edited text flows through). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_017rEaTnSaSneEMEJvebzM53 * test(browser): pin the annotate-mode Escape exemption for annotation edits The data-slot annotation-edit clause in useGrabMode's capture keydown listener had no test that dispatched a keydown through it, so deleting the clause left the suite green. These tests invoke the real registered capture handler with an Escape whose target sits inside (and outside) an annotation-edit container; the inside case uses a button, which isEditableKeyboardTarget does not cover, so only the exemption clause can keep grab mode alive. Removing the clause now fails the suite. --------- Co-authored-by: Claude Fable 5 <[email protected]>
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.

ELI5
When you annotate an element in the embedded browser and make a typo, the only way to fix it today is to delete the annotation and re-pick the element on the page. This PR adds a small pencil button to each annotation row in the tray: click it, fix the text or intent right there, save. The element you picked stays picked.
What Changed
updateBrowserPageAnnotation(pageId, annotationId, patch)next to the existing add/delete/clear actions. It no-ops (same state reference) when the id is missing and runs the merged annotation through the existingsanitizeBrowserPageAnnotation, so edits obey the same comment length budget as adds.data-slot="annotation-edit"), so Escape cancels only the row edit instead of tearing down the whole annotate session. A capture listener fires before descendant React handlers, so this cannot be solved withstopPropagationfrom inside the row.Deliberately untouched: annotation element targets, cross-navigation persistence, and
browser-annotation-output.ts(the send/copy builder reads comment and intent live off the array, so edited text flows through with no change).Why
Annotations queue up feedback for an agent; a typo or a wrong intent choice currently costs the whole annotation, including the picked element. Inline editing preserves the target and keeps the review flow moving. Editing lives in the tray row rather than re-opening the anchored composer because the compose popover's anchor geometry is only guaranteed while an add is pending; the inline row edit avoids that entire class of stale-anchor problems.
Linked Issue
Fixes #17501
Visual Proof
Before and after screenshots attached (before: hover reveals only delete; after: hover reveals edit + delete; after: the row in inline edit mode).

Testing
Manually verified on Windows in the dev app: pencil appears on hover, editing seeds current values, save updates the row and the copied feedback, cancel and Escape leave the annotation unchanged, Escape does not exit annotate mode.
Automated: 3 new store tests (update merges and sanitizes like add; nonexistent id is a strict no-op) and a new component test for the tray (seeded editor, save passes trimmed comment and chosen intent, cancel restores the read view, Escape regression). Full targeted suite: 83 tests across 12 files pass. Typecheck passes for node, web, and cli projects; oxlint clean on changed files; max-lines ratchet clean; localization catalog, extraction, and coverage checks pass.
AI Disclosure
Built with Claude Code (Claude Fable 5). The implementation, tests, and an adversarial review pass were AI-generated under human direction and manual verification; the feature was manually tested in the running app by the author.
Review
AI code-review summary (adversarial pass over the diff):
isScreenSubmitShortcuthelper which already handles the Mac/Windows modifier split.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
No security, SSH, mobile, or backwards-compatibility surface is touched; the change is confined to the renderer's annotate components and one store slice. The one subtle interaction (annotate mode's global Escape handling) is covered by a dedicated regression test.
Author
X: @Sahir__S
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code