feat(mapbox): Add widget support to MapboxOverlay via IControl adapter - #9963
feat(mapbox): Add widget support to MapboxOverlay via IControl adapter#9963chrisgervang wants to merge 11 commits into
Conversation
40d85b9 to
9426c8c
Compare
79355a6 to
287b467
Compare
287b467 to
e793c90
Compare
Widgets with `viewId: 'mapbox'` are extracted from the deck overlay and wrapped as native map IControl instances, positioning them alongside native controls like NavigationControl. - Add DeckWidgetControl IControl adapter - Update MapboxOverlay to process widgets and manage control lifecycle - Suppress widget margin inside basemap control containers (CSS) - Add unit tests for widget support in MapboxOverlay - Add "Using Widgets" guide to MapboxOverlay docs - Add whats-new entry Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
76f0325 to
c3668c5
Compare
…chr/mapbox-widget-support
…ntainers Fill widgets (placement: 'fill') use the map container as their parent instead of the control div, since the basemap's transform: translate(0) creates a small containing block that breaks position: absolute spanning. The empty control div is hidden via display: none. Reset basemap button hover/active background-color that leaks into deck widget buttons via .mapboxgl-ctrl / .maplibregl-ctrl selectors. Add 20 edge case tests covering widget lifecycle, DOM structure, fill widget container routing, setProps preservation, placement changes, map.remove() cleanup, and duplicate widget ids.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 719ccdb. Configure here.
| this._widget.props._container = map.getContainer() as HTMLDivElement; | ||
| } else { | ||
| this._widget.props._container = this._container; | ||
| } |
There was a problem hiding this comment.
Fill widgets block map interaction
High Severity
Fill widgets with viewId: 'mapbox' set _container to map.getContainer() and are appended there directly. That skips WidgetManager's pointer-events: none overlay wrapper, so full-bleed roots like SplitterWidget keep default pointer-events: auto and capture pan/zoom over the whole map. Only explicit pointer-events: auto children were meant to be interactive.
Reviewed by Cursor Bugbot for commit 719ccdb. Configure here.


Closes #9962
Background
Enable deck widgets to coexist with native Mapbox/MapLibre controls without DOM overlap by rendering widgets with
viewId: 'mapbox'into the map's control container system via the new_containerprop.Change List
DeckWidgetControlclass that wraps deck widgets as Mapbox IControlsviewId: 'mapbox'in MapboxOverlay, automatically wrapping them as IControlswidget.props._containerto Mapbox-positioned element so WidgetManager appends thereNote
Medium Risk
Changes DOM/control lifecycle integration with Mapbox/MapLibre and widget
_containertiming; scope is UI positioning with broad test coverage, not core rendering or auth.Overview
MapboxOverlay can now place deck.gl widgets in the basemap’s native control UI by setting
viewId: 'mapbox'on a widget. Those widgets are wrapped asDeckWidgetControl(IControl) instances,widget.props._containeris set before Deck/WidgetManagerinit, and controls are added/updated/removed onsetProps(reuse by widget id when placement is unchanged).placement: 'fill'widgets attach tomap.getContainer()instead of the control div (with CSS to hide the empty control and fix margins/hover styles instylesheet.css).onRemoveavoids double-removing child controls when the overlay is already off the map’s control list.Docs add a Using Widgets section on
MapboxOverlay(limitations for view/canvas widgets) and a whats-new note. Tests and the Mapbox mock (hasControl,removeControl) cover overlaid/interleaved lifecycle, fill vs corner placement, and mapremove().Reviewed by Cursor Bugbot for commit 719ccdb. Bugbot is set up for automated code reviews on this repo. Configure here.