Skip to content

Generalize anchor layout for webviews#310030

Open
mjbvz wants to merge 3 commits intomicrosoft:mainfrom
mjbvz:dev/mjbvz/quintessential-cobra
Open

Generalize anchor layout for webviews#310030
mjbvz wants to merge 3 commits intomicrosoft:mainfrom
mjbvz:dev/mjbvz/quintessential-cobra

Conversation

@mjbvz
Copy link
Copy Markdown
Collaborator

@mjbvz mjbvz commented Apr 14, 2026

Previously I only changed this for webview editors but it makes sense to do for other webview too

This also updates the clipping to use anchor position so that the entire layout flow should be handled by browsers now

Fixes #130353

Previously I only changed this for webview editors but it makes sense to do for other webview too
Copilot AI review requested due to automatic review settings April 14, 2026 23:50
@mjbvz mjbvz self-assigned this Apr 14, 2026
@mjbvz mjbvz enabled auto-merge April 14, 2026 23:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR generalizes the CSS Anchor Positioning–based layout behavior from the webview editor implementation into the shared OverlayWebview so that all overlay-based webviews can benefit from automatic position tracking between explicit layout calls.

Changes:

  • Removed the editor-specific CSS anchor positioning setup/cleanup from WebviewEditor.
  • Added centralized CSS anchor positioning support to OverlayWebview.layoutWebviewOverElement, with a pixel-position fallback when unsupported.
  • Added anchor cleanup on OverlayWebview.release/dispose to avoid leaking anchor-related styles.
Show a summary per file
File Description
src/vs/workbench/contrib/webviewPanel/browser/webviewEditor.ts Removes editor-local anchor positioning so layout behavior is owned by the shared overlay implementation.
src/vs/workbench/contrib/webview/browser/overlayWebview.ts Implements anchor positioning in the shared overlay layout path and adds cleanup for anchor-related styles.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 3

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.

Custom Webview in explorer view placed at wrong position

2 participants