Skip to content

fix(core): position widgets relative to their canvas - #10491

Merged
ibgreen merged 1 commit into
masterfrom
codex/multi-canvas-widget-positioning
Jul 27, 2026
Merged

ibgreen merged 1 commit into
masterfrom
codex/multi-canvas-widget-positioning

Conversation

@ibgreen-openai

@ibgreen-openai ibgreen-openai commented Jul 27, 2026 •

Copy link
Copy Markdown
Collaborator

Goal

Position existing Deck widgets and tooltips correctly when their rendering canvas is offset from the shared widget root.

Changes

  • Resolve canvas bounds relative to the shared widget root, with an optional internal bounds resolver for alternate presentation surfaces.
  • Size root-level widget containers from their actual parent, and offset view-specific containers by their canvas position.
  • Apply the same canvas offset to built-in hover tooltips.
  • Clarify widget root, viewId, and placement documentation and TSDoc.
  • Add focused regressions for root sizing, view-container offsets, and tooltip placement.

Scope

Seven widget implementation, documentation, and test files only. No Deck API changes, multi-canvas props, presentation contexts, event-manager lifecycle changes, or example applications.

Validation

  • ./node_modules/.bin/tsc -p modules/core/tsconfig.json --noEmit --pretty false
  • yarn test-headless test/modules/core/lib/widget-manager.spec.ts test/modules/core/lib/tooltip.spec.ts test/modules/core/lib/deck.spec.ts --retry 1 --silent — 39 tests passed.
  • Repository lint/format checks and 21 node smoke tests passed through the pre-commit hook.

Stack

  1. This PR: independent widget-root geometry and tooltip positioning.
  2. RFC/POC: Extend View system to support multi-canvas rendering #10229: multi-canvas presentation and interaction, stacked on this preparation.
  3. docs(core): multi-canvas add standalone cities example #10492: standalone multi-canvas cities example, stacked on RFC/POC: Extend View system to support multi-canvas rendering #10229.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 83.323% (+0.02%) from 83.304% — codex/multi-canvas-widget-positioning into master

@ibgreen
ibgreen marked this pull request as ready for review July 27, 2026 19:45
@ibgreen
ibgreen merged commit eec51a7 into master Jul 27, 2026
5 checks passed
@ibgreen
ibgreen deleted the codex/multi-canvas-widget-positioning branch July 27, 2026 19:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e82274bc6e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +151 to +155
const canvasBounds = canvas?.getBoundingClientRect();
const parentBounds = this.parentElement?.getBoundingClientRect();
return {
x: canvasBounds && parentBounds ? canvasBounds.left - parentBounds.left : 0,
y: canvasBounds && parentBounds ? canvasBounds.top - parentBounds.top : 0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Measure from the actual positioned widget origin

In the React integration, parentElement is the unpositioned .deck-widgets-root rendered after the heightful .deck-events-root, while the absolutely positioned widget containers use the positioned wrapper as their containing block. Subtracting the widget root's rectangle therefore commonly produces a canvas y offset of roughly minus the Deck height, moving every tooltip and view-scoped widget offscreen. Resolve bounds against the containers' actual containing block, or make the widget root itself cover and position the shared widget area.

Useful? React with 👍 / 👎.

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.

4 participants