Skip to content

feat(mapbox): Add widget support to MapboxOverlay via IControl adapter - #9963

Open
chrisgervang wants to merge 9 commits into
masterfrom
chr/mapbox-widget-support
Open

feat(mapbox): Add widget support to MapboxOverlay via IControl adapter#9963
chrisgervang wants to merge 9 commits into
masterfrom
chr/mapbox-widget-support

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Jan 25, 2026

Copy link
Copy Markdown
Collaborator

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 _container prop.

Screenshot 2026-04-06 at 5 27 21 PM

Change List

  • Add DeckWidgetControl class that wraps deck widgets as Mapbox IControls
  • Process widgets with viewId: 'mapbox' in MapboxOverlay, automatically wrapping them as IControls
  • Set widget.props._container to Mapbox-positioned element so WidgetManager appends there
  • Widgets stack correctly with native controls in the same DOM container, preventing overlap

Note

Medium Risk
Touches overlay lifecycle, map control registration, and widget DOM mounting; mistakes could leak controls or break widget updates on setProps/remove.

Overview
MapboxOverlay can now place deck.gl widgets in the same control stack as native Mapbox/MapLibre UI (e.g. NavigationControl) so they do not overlap deck’s overlay container.

Widgets with viewId: 'mapbox' are wrapped as IControl instances via a new DeckWidgetControl. MapboxOverlay registers those controls on the map, sets each widget’s _container before Deck / WidgetManager run, and reuses controls when setProps passes new widget instances with the same id and placement. Overlay removal avoids mutating the map’s control list during map.remove() iteration.

Widget CSS drops extra margin when widgets sit inside deck-widget-ctrl. Docs describe default vs map-positioned widgets and limitations (view controls, screenshot in interleaved mode, fullscreen container). Tests and the Map mock cover control lifecycle, placement, and cleanup.

Reviewed by Cursor Bugbot for commit 5474ab7. Bugbot is set up for automated code reviews on this repo. Configure here.

@coveralls

coveralls commented Jan 25, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 83.789% (+0.04%) from 83.752% — chr/mapbox-widget-support into master

Comment thread modules/mapbox/src/mapbox-overlay.ts
@chrisgervang chrisgervang mentioned this pull request Jan 25, 2026
62 tasks
Comment thread modules/mapbox/src/deck-widget-control.ts Outdated
@chrisgervang chrisgervang added this to the v9.3 milestone Feb 2, 2026
@chrisgervang
chrisgervang force-pushed the chr/mapbox-widget-support branch from 40d85b9 to 9426c8c Compare February 4, 2026 23:24
Comment thread modules/mapbox/src/mapbox-overlay.ts
Comment thread modules/mapbox/src/mapbox-overlay.ts Outdated
Comment thread modules/mapbox/src/mapbox-overlay.ts
@chrisgervang
chrisgervang force-pushed the chr/mapbox-widget-support branch from 79355a6 to 287b467 Compare February 27, 2026 19:08
@chrisgervang
chrisgervang force-pushed the chr/mapbox-widget-support branch from 287b467 to e793c90 Compare March 9, 2026 18:06
Comment thread modules/mapbox/src/deck-widget-control.ts
@ibgreen ibgreen mentioned this pull request Mar 22, 2026
31 tasks
Comment thread test/modules/mapbox/mapbox-overlay.spec.ts Outdated
Comment thread modules/mapbox/src/mapbox-overlay.ts
Comment thread modules/mapbox/src/mapbox-overlay.ts

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ 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 afec60a. Configure here.

Comment thread examples/get-started/pure-js/maplibre/app.js Outdated
@ibgreen ibgreen mentioned this pull request May 2, 2026
59 tasks
@chrisgervang chrisgervang modified the milestones: v9.3, v9.4 Jun 11, 2026
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>
@chrisgervang
chrisgervang force-pushed the chr/mapbox-widget-support branch from 76f0325 to c3668c5 Compare June 12, 2026 18:06
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.

feat(mapbox): Add widget support to MapboxOverlay via IControl adapter

3 participants