Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text-field color (paint prop) ignores text-color in format (layout prop) after feature-state change #5304

Open
zmatez opened this issue Jan 7, 2025 · 1 comment
Labels
need more info Further information is requested

Comments

@zmatez
Copy link

zmatez commented Jan 7, 2025

maplibre-gl-js version: 4.7.1

browser: firefox

Steps to Trigger Behavior

Use feature state expression to change text-color while also using format inside text-field expression to change color.
Toggle feature state on and then off.

Original issue (not resolved by mapbox from 2020, but I just faced the same here): mapbox/mapbox-gl-js#9711

Link to Demonstration

Expected Behavior

It should reevaluate all color logic. Maybe add text value 'inherit' to 'text-color' in paint so that it can use those values rather than required fallback color (in my case #000000)

Actual Behavior

After changing feature-state expression 'format' colors are ignored, instead it uses default fallback color

paint: {
                'text-color': [
                    "case",
                    ["boolean", ["feature-state", "selected"], false], "#6a050a",
                    '#000000' // gets back to black instead using 'format' logic from 'layout'
                ]
            }```
however on start if feature-state is not changed, colors display properly
@HarelM
Copy link
Collaborator

HarelM commented Jan 7, 2025

Thanks for taking the time to open this issue.
There are a lot of bugs with feature state unfortunately...
Can you please create a minimal reproduction using jsbin or a similar service?

@HarelM HarelM added the need more info Further information is requested label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need more info Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants