Skip to content

Conversation

@chrisgervang
Copy link
Collaborator

@chrisgervang chrisgervang commented Jan 25, 2026

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.

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 MapboxOverlay lifecycle and DOM/control management, which could affect widget mounting/unmounting and setProps behavior across interleaved/overlaid modes.

Overview
Adds widget placement support to MapboxOverlay by introducing DeckWidgetControl, an IControl adapter that mounts deck.gl widgets into Mapbox/MapLibre’s native control containers (via widget.props._container) when widget.viewId === 'mapbox'.

MapboxOverlay now creates/updates/removes these widget controls on onAdd, setProps, and onRemove, reusing existing controls by widget id when placement is unchanged to avoid DOM orphaning; tests and mocks are updated to cover overlaid/interleaved widget behavior and control lifecycle (plus a minor test GL setup cleanup).

Written by Cursor Bugbot for commit 67aeed4. This will update automatically on new commits. Configure here.

chrisgervang and others added 2 commits January 25, 2026 11:30
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.

- Add DeckWidgetControl class that wraps deck widgets as IControls
- Process widgets with viewId: 'mapbox' in MapboxOverlay
- Set widget._container to Mapbox-positioned element via IControl
- Widgets stack correctly with native controls in same container

Closes #9962

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add TestWidget class for testing widget integration
- Test regular widgets render in deck container
- Test widgets with viewId: 'mapbox' are wrapped as IControl
- Test mixed widgets (regular + mapbox)
- Test setProps updates widget controls
- Test interleaved mode widget support
- Update mock map to support control positions and hasControl

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@coveralls
Copy link

coveralls commented Jan 25, 2026

Coverage Status

coverage: 91.118% (+0.02%) from 91.101%
when pulling 67aeed4 on chr/mapbox-widget-support
into 914c3d2 on master.

Copy link

@cursor cursor bot left a comment

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.

@chrisgervang chrisgervang mentioned this pull request Jan 25, 2026
62 tasks
chrisgervang and others added 3 commits January 26, 2026 22:03
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Overlaid mode tests create their own Deck instances which can cause GL
context corruption when sharing contexts across tests. Using an isolated
WebGLDevice for these tests prevents hangs in the test suite.

Co-Authored-By: Claude (global.anthropic.claude-opus-4-5-20251101-v1:0) <noreply@anthropic.com>
…d rootElement

When setProps was called with widgets, _processWidgets would destroy and
recreate all DeckWidgetControls. This removed the container from the DOM,
orphaning the widget's rootElement since WidgetManager wouldn't re-attach
it (same widget id means no change detected).

Now matches widgets by id (like WidgetManager) and only recreates controls
when the widget is new or placement changes. For existing widgets with same
id and placement, the container is preserved and copied to the new widget
instance to support React patterns where widgets are recreated on render.

Co-Authored-By: Claude (global.anthropic.claude-opus-4-5-20251101-v1:0) <noreply@anthropic.com>
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