Repository navigation
Conversation
[Medium impact] The PR appears safe to merge, with no new actionable issues found. SummaryKeeps basemap controls above the deck canvas by changing DOM order instead of using a negative
No new actionable issues were found in the changes since the previous review. No previous review threads were supplied. Reviews (5) · Last reviewed commit: "revert: leave DeckPicker to the WebGPU p..." · Reviewed by Greptile |
chrisgervang
left a comment
There was a problem hiding this comment.
Reviewed at 497790435. Two P1s: a shared device canvas now draws 300 px to the right, and the new stacking needs an upgrade-guide entry.
I compared 9.4.1 with and without this PR in headless Chromium, across react-map-gl, MapboxOverlay, GoogleMapsOverlay and pure-JS Deck. Map controls now draw above the layers and take clicks. The overlays look the same on both.
Labels: P1 settle before this is merged, P2 can follow, nit optional.
| const {canvas: placeholder, parent} = this.props; | ||
| if (placeholder instanceof HTMLCanvasElement && placeholder.isConnected) { | ||
| // Keep the stacking order of the canvas it stands in for | ||
| placeholder.after(this.canvas); |
There was a problem hiding this comment.
P1: This breaks the website's WebGL2/WebGPU device-tab examples. A shared device canvas now goes in after the 300x150 inline placeholder canvas, and it has no left or top, so it draws 300 px to the right.
- On the website with 9.4.1 plus this PR, scatterplot-layer and arc-layer draw 300 px off the basemap on both tabs. Hovering a drawn dot or arc picks a different object or nothing.
- Pure-JS
new Deck({device, parent, canvas})with a staticcanvasshifts the same way. - The new test checks DOM order only, so it passes.
| 9.4.1 | this PR | |
|---|---|---|
| scatterplot-layer, WebGL2 tab | ![]() |
![]() |
Could we set left: 0; top: 0 on the inserted canvas, or hide the placeholder? #10994 changes this insert too, so one fix could cover both.
Details
- The same shift shows with react-map-gl MapLibre and Mapbox children and with no basemap, on a device made as in
website/src/store/device-store.jsx. It is there on first mount, after a remount, and after client-side navigation. - global-grids, which uses an overlay with the shared device, looks the same on both.
- On 9.4.1 the device canvas covered
.deck-events-root, so point-cloud-layer got no hover. With this PR hover reaches deck, but at the shifted spot. An absolute, full-sizecanvaspassed withdevicenow gets hover that lines up.
There was a problem hiding this comment.
All addressed, thanks! 🙏
61c7312 hides the placeholder so the shared canvas no longer shifts, adds the upgrade-guide entry and uses --map. With the canvas in place, WebGPU hover picked the object mirrored top to bottom, because DeckPicker always flipped y for WebGL's framebuffer. e41af4e flips it only on WebGL.
There was a problem hiding this comment.
Let's not change the picker in this PR. We prefer small focused PRs for core changes, and we had already started to fix the picker in #11020
| @@ -5,7 +5,8 @@ | |||
| import * as React from 'react'; | |||
| import {cloneElement} from 'react'; | |||
|
|
|||
| const MAP_STYLE = {position: 'absolute', zIndex: -1}; | |||
| // No z-index: it would make the map a stacking context and trap its controls under the canvas | |||
| const MAP_STYLE = {position: 'absolute'}; | |||
There was a problem hiding this comment.
P1: Map controls now draw above any <DeckGL> child without z-index: 2 or higher. Apps will see this in a 9.4 patch, so it needs an upgrade-guide entry.
| master | head | |
|---|---|---|
| Overlay child | ![]() |
![]() |
Could we add this under "Upgrading to v9.4"?
### React: basemap controls draw above layers (v9.4.2)
This applies if you render a react-map-gl `<Map>` inside `<DeckGL>` along with your own HTML elements, such as a legend or panel.
Map controls and attribution now draw above deck.gl layers and take clicks. They can also cover your elements. To keep an element on top, give it `position: absolute` and `z-index: 2` or higher.Details
- With MapLibre and Mapbox, a red div child with no z-index or
zIndex: 1ends up under the attribution. WithzIndex: 2it stays on top. - Deck widgets come later in the DOM at z-index 2, so they stay above map controls.
- The DeckGL wrapper keeps
zIndex: 0, so map controls do not rise above page elements outside it.
| ); | ||
|
|
||
| if (viewMaps.length) { | ||
| maps.push(wrapChildren(`view-${viewId}-map`, viewMaps)); |
There was a problem hiding this comment.
nit: Views main and main-map would both produce the DOM id view-main-map. The PR body says view-<id>--map. Could the code and body agree on one suffix?
4977904 to
0a6e3b3
Compare
Drop the react-map-gl change and its test. deck.gl should not reach into react-map-gl's DOM; the React stacking fix is in #10997. Also remove the before/after screenshots from dev-docs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMqFS7mGJ9M1FLcwfC6
visgl#11199) * fix(maplibre): keep overlaid canvas below map controls * docs(maplibre): explain control slot placeholder * fix(react): keep map controls above the Deck canvas * docs(maplibre): clarify control ordering and refresh screenshot * fix(react): retain basemap ordering while loading * fix(maplibre): limit control ordering fix to MapLibreOverlay Drop the react-map-gl change and its test. deck.gl should not reach into react-map-gl's DOM; the React stacking fix is in visgl#10997. Also remove the before/after screenshots from dev-docs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LGNhMqFS7mGJ9M1FLcwfC6 --------- Co-authored-by: Claude <[email protected]>
The shared device canvas went in after the inline placeholder, so it drew 300 px to the right. Also adds the upgrade-guide entry and uses --map for the map wrapper id so it can't collide with a view named <id>-map.
DeckPicker always asked cssToDevicePixels for bottom-left coordinates, which suits WebGL. WebGPU scissor rects and texture reads start at the top-left, so every WebGPU pick read the row mirrored top to bottom. Invert y only when the device isn't WebGPU, in both point and rect picks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nalize Deck hides props.canvas while a shared device canvas draws in its place, but left it hidden after finalize. Remember its inline display and put it back when Deck is finalized. Co-Authored-By: Claude Opus 5.5 <[email protected]>
After finalize restored props.canvas, a new Deck reusing the device found the shared canvas still in the DOM, skipped the hide, and drew 300 px to the right again. Hide the stand-in whenever a shared canvas draws in its place, and take the shared canvas out on finalize so the restored canvas can't offset it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This reverts commit e41af4e. The mirrored WebGPU picking is tracked in visgl#11020 and fixed separately, so this PR stays on canvas mounting. Co-Authored-By: Claude Opus 5.5 <[email protected]>
775832b to
0948bb6
Compare
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 0948bb6. Configure here.
evaluateChildren set the map style on the props object shared by every child of a View, so a later child that spreads its props was taken for a map and moved under the canvas.
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.





Closes #10917
evaluateChildrengives a Map childzIndex: -1, which makes it a stacking context, so its controls'z-index: 2can't lift them above the canvas. Settingz-index: 1on the canvas, as the issue suggests, would also pushposition: absolutechildren under it, such as the attribution in the terrain-extension example. This renders the map before the canvas instead, so neither needs a z-index.The main changes are in
evaluateChildren(drops the map'szIndex: -1) andpositionChildrenUnderViews(returns maps separately, wrapped inview-<id>--map).DeckGLrenders maps before the canvas, andDeckinserts a shared device canvas after its placeholder and hides the placeholder.DeckPickernow flips y only on WebGL, since WebGPU picks read from the top-left.Tested with
test/modules/reactanddeck.spec.tsin headless Chromium, and with a real MapLibre map — the attribution and zoom buttons are on top of the canvas after this change and weren't before.#10994 changes the same canvas insert in
Deck. I can rebase on it if it lands first.Note
Low Risk
Changes DOM ordering for React basemaps and shared canvas elements with no impact on core rendering pipelines.
Overview
Changes the DOM stacking order in
<DeckGL>so basemap components (such asreact-map-glinstances) render before the canvas element, while other view children render after it. Removingz-index: -1from the map container prevents it from creating a separate stacking context, allowing map controls withz-index: 2(like zoom buttons and attribution) to sit above the deck.gl canvas.Deckin@deck.gl/coreis also updated to handle shared device canvases by hiding the placeholder canvas and inserting the shared canvas directly after it, preserving the expected DOM order during rendering and cleaning up onfinalize().Updated documentation and upgrade guides note that basemap controls now receive pointer events and sit above deck layers, and advise using
position: absoluteandz-index: 2or higher for custom overlay elements.Reviewed by Cursor Bugbot for commit 88df037. Bugbot is set up for automated code reviews on this repo. Configure here.