Slider: marker data-state ignores origin "center" / "end"
Maintainers usually reply within 1 day
@itisrmk is already working on this.
Since Dec 1, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 80/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, typescript
- Domain
- frontend
Research direction
Start with getMarkerProps and getRangeOffsets in slider.connect.ts, then run the provided repro.mjs script to compare marker states with the filled range. Add or update slider marker tests to cover single-value sliders with origin set to start, center, and end. The work is done when each marker’s state reflects whether it lies within the filled range for every origin.
Written by the indexing model from the issue text.
Description
🐛 Bug report
With origin: "center" or origin: "end", the slider fills the track from the origin to the thumb, but the markers still get their data-state from comparing their value with the slider value only. So marker styling that follows the docs' selector ([data-part="marker"][data-state="under-value"] for the filled part) colours the wrong markers.
For a centred slider at 70 the track is filled from 50 to 70, yet markers 0 to 40 report under-value like the ones on the filled part. At 30 it gets worse: the track is filled from 30 to 50, and marker 40, which sits on the filled part, reports over-value. With origin: "end" it's fully inverted.
Range sliders (two thumbs) are fine, the markers between the thumbs report at-value.
💥 Steps to reproduce
- Create a single-value slider with
origin: "center"anddefaultValue: [70] - Add markers at 0, 10, ... 100
- Read each marker's
data-stateand compare it with--slider-range-start/--slider-range-endon the root
💻 Link to reproduction
No sandbox, but it needs no DOM, so here's a plain Node script (npm i @zag-js/slider @zag-js/vanilla, then node repro.mjs):
import * as slider from "@zag-js/slider"
import { VanillaMachine, normalizeProps } from "@zag-js/vanilla"
// headless: no DOM needed to read the props
const fakeRoot = { getElementById: () => null, querySelector: () => null, querySelectorAll: () => [] }
for (const [origin, value] of [["start", 70], ["center", 70], ["center", 30], ["end", 70]]) {
const machine = new VanillaMachine(slider.machine, { id: "s", origin, defaultValue: [value], getRootNode: () => fakeRoot })
machine.start()
const api = slider.connect(machine.service, normalizeProps)
const root = api.getRootProps().style
const markers = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100].map((v) => `${v}:${api.getMarkerProps({ value: v })["data-state"]}`)
console.log(`origin=${origin} value=${value} range-start=${root["--slider-range-start"]} range-end=${root["--slider-range-end"]}`)
console.log(" " + markers.join(" "))
machine.stop()
}
Output with 1.49.0:
origin=start value=70 range-start=0% range-end=30%
0:under-value 10:under-value 20:under-value 30:under-value 40:under-value 50:under-value 60:under-value 70:at-value 80:over-value 90:over-value 100:over-value
origin=center value=70 range-start=50% range-end=30%
0:under-value 10:under-value 20:under-value 30:under-value 40:under-value 50:under-value 60:under-value 70:at-value 80:over-value 90:over-value 100:over-value
origin=center value=30 range-start=30% range-end=50%
0:under-value 10:under-value 20:under-value 30:at-value 40:over-value 50:over-value 60:over-value 70:over-value 80:over-value 90:over-value 100:over-value
origin=end value=70 range-start=70% range-end=0%
0:under-value 10:under-value 20:under-value 30:under-value 40:under-value 50:under-value 60:under-value 70:at-value 80:over-value 90:over-value 100:over-value
The marker states are identical for start, center and end, while the filled range differs.
🧐 Expected behavior
A marker's state tells whether it sits on the filled part of the track, the same way the range does. For origin: "center" at 70, markers 50 to 60 are on the filled part and 0 to 40 and 80 to 100 aren't. For origin: "end" at 70, markers 80 to 100 are on the filled part.
🧭 Possible Solution
getMarkerProps in slider.connect.ts compares props.value with first(sliderValue) and last(sliderValue). For a single value it could compare with the range the origin produces (origin value to thumb), the same bounds getRangeOffsets uses. If changing what under-value / over-value mean feels too breaking, a separate attribute like data-in-range would work for us too.
🌍 System information
| Software | Version(s) |
|---|---|
| Zag Version | @zag-js/slider 1.49.0 (also 1.47.0, via @ark-ui/svelte) |
| Browser | any (reproduced headless in Node 24) |
| Operating System | any |
📝 Additional information
We ran into it building Material 3's centred slider, where stop indicators on the active track use a different colour than the ones on the inactive track.
- Dominant language
- TypeScript
- Stars
- 5.3k
- Forks
- 320
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 60
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from chakra-ui/zag
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
date-input: zoned values show in the timeZone prop (UTC) instead of their own zonePossibly taken @Yahiro025 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
dismissable: LayerDismissEvent isn't exportedPossibly taken @abu-tahir-0 claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
Maintainers usually reply within 1 day
Similar issues
-
feature
Difficulty 1/5 Under an hour Newbie friendliness 78/100
ChromeDevTools/chrome-devtools-mcp#3689 ·
Maintainers usually reply within 1 day
-
bug from-app needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
nightly-labs/openbot#21303 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ADORSYS-GIS/CoopData#282 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OHDSI/Data2Evidence#3816 ·
Maintainers usually reply within 3 days
-
`ovsx verify` fails for a version older than the 100 newest of an extensionPossibly taken @trivikr claimed this today. Opencli
Difficulty 2/5 1-3 hours Newbie friendliness 81/100
eclipse-openvsx/openvsx#2482 · 2 comments ·
Maintainers usually reply within 1 day