Repository navigation
fix(react): align widget root with the DeckGL canvas - #10724
Conversation
|
chrisgervang
left a comment
There was a problem hiding this comment.
Thanks for including an issue and visual explanations.
Do we have sufficient coverage for fill widgets? They should continue to get a container that matches the deck canvas
|
Thanks for the review and approval, @chrisgervang! Good point about fill widgets. I added explicit coverage in fdaa57f: both the All 42 focused browser tests pass (one existing skip), along with the 19 smoke tests, lint, and build. I've also updated the branch with current master. The earlier full coverage CI failed with WebGL uniform-block errors; a fresh full-suite result is still outstanding. |
| {id: `${id || 'deckgl'}-wrapper`, ref: containerRef, style: containerStyle}, | ||
| [eventRoot, widgetRoot] | ||
| // Preserve a containing block even when the caller puts the wrapper in normal flow. | ||
| createElement('div', {style: {position: 'relative', width: '100%', height: '100%'}}, [ |
There was a problem hiding this comment.
Can this div get a class, deck-root or similar? It currently shows up as an anonymous div between the wrapper and the event/widget roots in devtools, and any third-party CSS using a child combinator (#deckgl-wrapper > .deck-events-root) silently stops matching. Nothing in this repo selects on that relationship, but it's a structural change to a public component's DOM, so a named hook is cheap insurance.
Also worth a line in the description: positionChildrenUnderViews emits position: absolute children, which now resolve against this div's content box instead of the wrapper's padding box. That only differs when a caller passes padding or border in style, and the new behavior is the correct one — the children line up with the canvas — but someone compensating for the old offset would see a shift.
There was a problem hiding this comment.
Addressed in c3e8f25: added deck-root. Also updated the PR description to explain the extra DOM level’s effect on direct-child selectors and the alignment change for view children when the wrapper has padding or borders. Thanks for pointing these out.
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 9753bcd. Configure here.
## Describe your changes Pydeck tooltips sit on the cursor again. deck.gl 9.4 places them by subtracting `.deck-widgets-root` from the canvas, and that root was laid out one chart height below the map, so the tooltip rendered above the pointer. The chart container stretches `.deck-widgets-root` over the canvas (`position: absolute; inset: 0; pointer-events: none`). Those are the same properties as the deck.gl fix that is merged but not in a release yet ([visgl/deck.gl#10724](visgl/deck.gl#10724)). Downgrading `@deck.gl/*` from 9.4.0 to 9.3.11 would drop the rest of the 9.4 fixes, and pinning only core or only react breaks their peer ranges. The rule does not use `!important`, so the same inline styles win when they ship. ## GitHub Issue Link (if applicable) - Closes #17309 ## Testing Plan - No frontend unit test: jsdom's mocked DeckGL never mounts `.deck-widgets-root`, so it cannot reproduce the offset. - [x] E2E Tests: `e2e_playwright/st_pydeck_chart_test.py::test_pydeck_tooltip_stays_near_cursor` checks that the tooltip origin stays within 16px of the cursor and that the widget root is not the hit target. Firefox is skipped because CI never mounts the deck tooltip there; Chromium and WebKit still run it. - Manual: default height, `height=250`, `height="stretch"`, and fullscreen all kept the tooltip on the cursor. Pan and Mapbox zoom still receive clicks.
(cherry picked from commit c55cce0)
|
Released in deck.gl 9.4.1. Thanks @brandon-julio-t! |

Closes #10723
Background
The React widget root falls below the canvas, positioning tooltips offscreen. A dedicated
deck-rootcontaining block aligns the canvas and widgets even when the outer wrapper usesposition: static.The added DOM level changes direct-child CSS selectors. Absolutely positioned view children now align with the canvas inside wrapper padding/borders; applications compensating for the previous offset may see a shift.
Change List
DeckGLcanvas and widgets within an internal containerVerified: 73 focused browser tests, 19 smoke tests, lint. Full coverage CI passed on
cce39c7; CI for this review follow-up is pending.Before/after tooltip hover:
tooltip-before-after.webm
Static wrapper: original PR (left), containing-block fix (right):
Note
Medium Risk
The extra DOM nesting and moving the Deck parent ref can shift layout for apps using direct-child CSS or compensating for the old widget offset.
Overview
Fixes React DeckGL widget/tooltip misalignment by changing the rendered DOM so the canvas and widget layer share one layout box.
The outer
#deckgl-wrappernow only carries callerstyle/width/height, while a new inner.deck-root(withcontainerRef) isposition: relativeand holds the event/canvas tree plus.deck-widgets-root. The widget root gets inlineposition: absolute; inset: 0; pointer-events: noneso tooltips, corner widgets, and fill placements track the canvas without relying on widget stylesheet CSS, including when the wrapper isposition: staticor uses padding/margins.Tests add a matrix covering absolute/static positioning, pixel vs percentage sizing, resize, tooltip coordinates, fill-widget bounds, and map pointer hit-testing; WebGPU “wait for final size” cases now assert sizes via
.deck-rootand padding instead of mocking wrapper dimensions.Reviewed by Cursor Bugbot for commit 4e0d980. Bugbot is set up for automated code reviews on this repo. Configure here.