Skip to content

Browser: Element Commenting - #328316

Draft
kycutler wants to merge 1 commit into
mainfrom
kycutler/commenting
Draft

Browser: Element Commenting#328316
kycutler wants to merge 1 commit into
mainfrom
kycutler/commenting

Conversation

@kycutler

Copy link
Copy Markdown
Collaborator

Closes #291482

Copilot AI review requested due to automatic review settings July 30, 2026 23:21
@kycutler kycutler self-assigned this Jul 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds element commenting to the integrated browser, connecting page annotations to chat attachments.

Changes:

  • Adds comment-mode selection, numbered pins, previews, and editing.
  • Synchronizes annotations with chat input and browser lifecycle.
  • Supports selectable split-button primary actions.
Show a summary per file
File Description
browserEditorChatFeatures.ts Connects comments to chat.
browserViewWorkbenchService.ts Supplies theme and localized strings.
workbench/.../common/browserView.ts Extends the renderer model.
browserViewMainService.ts Exposes commenting operations and menus.
browserViewInspector.ts Coordinates selection and comments.
browserViewFrameInspector.ts Bridges frame-level comment IPC.
electron-main/browserView.ts Serializes selection state.
preload-browserView.ts Implements annotation UI and interaction.
platform/.../common/browserView.ts Defines shared commenting contracts.
actions/common/actions.ts Adds primary-action allowlists.
menuEntryActionViewItem.ts Updates split-button primary behavior.

Review details

  • Files reviewed: 11/11 changed files
  • Comments generated: 6
  • Review effort level: Balanced

}
}

class AddElementCommentToChatAction extends Action2 {
Comment on lines +1344 to +1346
private _animateCommentHighlight(pinBounds: DOMRect, target: Element, supportingElements: readonly HTMLElement[], collapsing = false): Animation | undefined {
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
return undefined;
commentInput.setAttribute('aria-label', this._localizedStrings.commentOnSelectedElement);
commentInput.addEventListener('input', () => this._layoutCommentInput());
commentInput.addEventListener('keydown', event => {
if (event.key === 'Enter') {

private _onFocusIn = (): void => {
if (!this._selectionActive) {
if (!this._selectionActive || this._commentTarget || this._externalHighlightTarget) {
Comment on lines +427 to +431
const widget = await this._revealChatWidgetForAttachment(elementData.comment !== undefined);
if (!widget?.attachmentModel || this._disposedCommentModels.has(model)) {
return false;
}
widget.attachmentModel.addContext(...toAttach);
Comment on lines +352 to +354
setElementComments(update: IBrowserElementCommentsUpdate): void {
for (const inspector of this._registry.inspectors) {
inspector.setElementComments(update);
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.

Web Annotation System for sending batch annotations to Agent

2 participants