mapbox / mapbox/mapbox-gl-draw

Hide control group if no controls are displayed

Open
#703 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug ui
Dominant language
JavaScript
Stars
1.1k
Forks
612
Avg merge
8d 9h
Merged PRs (30d)
5

Description

**mapbox-gl-js version**: 0.40.1
**mapbox-gl-draw version**: 1.0.3

### Steps to Trigger Behavior

1. create a new draw instance with these settings:
```js
new MapboxDraw({
displayControlsDefault: false
});
```
2. A small square for the empty control group gets added. This square pushes down all other controls after it.

### Expected Behavior
If no controls are selected, then no control group for them should be added.

### Actual Behavior
Control group gets added.

### Why I'm posting this
I'm using custom buttons to trigger the events. So I want to hide the default controls. However there's no way to get rid of the empty control group element that takes up space in the top right section.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the MapboxDraw initialization path that handles displayControlsDefault and inspect how the control group is created when all default controls are disabled. Confirm the empty group is not added while selected controls and the placement of other controls remain unchanged; verify the behavior with the configuration shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.