mapbox / mapbox/mapbox-gl-draw

Flickering and Deselection When Clicking Vertices on Large GeoJSON Line Features

Open
#1,383 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description:
When adding a large GeoJSON line feature (e.g., complex geometries with thousands of vertices) to Mapbox-GL-Draw, selecting the feature and clicking on any of its vertices causes the layer to flicker and deselect the feature. The expected behavior is for the clicked vertex to be selected and remain interactive without losing the feature's selection state.

Steps to Reproduce:

Load a large GeoJSON line feature (e.g., a polyline with high vertex density) into Mapbox-GL-Draw.

Select the feature using draw.set({ }) or by clicking it.

Click on any vertex of the selected feature.

Expected Result:
The clicked vertex is highlighted, and the feature remains selected for further interactions (e.g., vertex drag-and-drop or deletion).

Actual Result:

The feature briefly flickers.

The selection state is lost (feature and vertex deselection).

The interaction requires reselecting the feature to proceed.

Environment:

Mapbox-GL-Draw version: [e.g., 1.4.2]

Mapbox-GL-JS version: [e.g., 1.13.0]

Browser: [e.g., Chrome 120, Firefox 115]

OS: [e.g., Windows 10,]

Additional Context:

Issue is more prominent with large datasets but may also occur with moderately complex geometries.

No console errors observed, suggesting a rendering/state synchronization issue. #

![Image](https://github.com/user-attachments/assets/d7af8393-21ea-4b81-b4ea-428227e76885)
![Image](https://github.com/user-attachments/assets/9d23bc3c-789e-41a4-8b05-8dca9998d84d)

[testClick.zip](https://github.com/user-attachments/files/19480689/testClick.zip)

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 reproducing the issue with the attached testClick.zip and a large GeoJSON line feature, using draw.set() before clicking a vertex. Trace the selection and vertex-click interaction path in Mapbox-GL-Draw. Done means the clicked vertex remains highlighted and the feature stays selected without flickering, including during further vertex interactions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.