mapbox / mapbox/mapbox-gl-draw

Firing an action if user clicks the trash control regardless of selection

Open
#813 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Mapbox GL Version: 0.45.0
Mapbox GL Draw Version: 1.0.9

### Steps to Trigger Behavior

1. Click trash icon

### Expected Behavior
Event to fire

### Actual Behavior
No change or action fired

--

Hello --

I was wondering if an action fires when a user clicks the trash can icon when there is nothing selected.

I have a very simple mapbox draw component that users can draw a single polygon on. I am noticing that they are clicking the trash icon without selecting their polygon. I am wondering if an action fires when they click the trash (or how I can set one up) so that it will call deleteAll().

Either that or is there a way to modify the css of the trash icon when nothing is selected so I can make it look disabled?

Thanks!

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 by tracing the trash control's click handling and its selection-dependent behavior; the issue names no file or test. Done requires a defined behavior when nothing is selected, such as an action that invokes deleteAll() or disabled visual treatment, with coverage for the empty-selection case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.