Color in `text-field` overrides color from `format` expression if `feature-state` is used
Nobody has claimed this yet.
- 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
- Use feature state expression to change
text-colorwhile also usingformatinsidetext-fieldexpression to change color. - Toggle feature state on and then off.
Link to Demonstration

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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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