mapbox / mapbox/mapbox-gl-js

Color in `text-field` overrides color from `format` expression if `feature-state` is used

Open
#9,711 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

mapbox-gl-js version: 1.10.1

browser: any

Steps to Trigger Behavior
  1. Use feature state expression to change text-color while also using format inside text-field expression to change color.
  2. Toggle feature state on and then off.
Link to Demonstration

2020-05-21 12-01-55 2020-05-21 12_02_21

https://jsbin.com/fiqeseqaja/edit?html,output

Interestingly, using setPaintProperty to change text-color does not demonstrate this bug:
https://jsbin.com/wequrakiga/edit?html,console,output

Expected Behavior

Expect text to return to color defined in format expression after feature state value changes.

Actual Behavior

All text uses color defined by text-color.

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 with the linked JS Bin reproductions and compare the feature-state toggle path with the setPaintProperty example. Trace the text-field format color handling and feature-state updates; done when toggling feature state restores the color defined by the format expression.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
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.