Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(core): floor the vertical Slider's touch hit area to 24px too (#5173)

Xinzi Zhouc78ac8f46bcb
diff --git a/.changeset/slider-vertical-touch-target.md b/.changeset/slider-vertical-touch-target.md
new file mode 100644
index 0000000000..703ed548f4
--- /dev/null
+++ b/.changeset/slider-vertical-touch-target.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[fix] `Slider` with `orientation="vertical"` now gets the same 24px touch hit area the horizontal one got: its track was still only 20px wide on coarse pointers, under the WCAG 2.5.8 AA minimum. The whole track is the tap target for both orientations — the fix that floored the horizontal track's block size did nothing for vertical, whose short axis is the inline one — so the inline size is now floored to 24px on touch, with the same `@media (pointer: coarse)` gate. The rail, fill, marks and thumb all center on the inline 50%, so nothing visible moves and desktop is untouched.
+
+@imdreamrunner
diff --git a/packages/core/src/Slider/Slider.tsx b/packages/core/src/Slider/Slider.tsx
index b1d15d7dc5..a131aa54a2 100644
--- a/packages/core/src/Slider/Slider.tsx
+++ b/packages/core/src/Slider/Slider.tsx
@@ -189,6 +189,16 @@ const styles = stylex.create({
trackContainerVertical: {
width: THUMB_SIZE,
height: 160,
+ // Same tap target, rotated: the vertical track is the thing you press, and
+ // it is only THUMB_SIZE (20px) wide. `minBlockSize` above floors the
+ // horizontal track's short axis; here the short axis is the inline one
+ // (the block size is already 160px), so floor that instead. The rail,
+ // fill, marks and thumb all center on the inline 50%, so they stay put;
+ // only the invisible tappable area grows. Desktop is unchanged.
+ minInlineSize: {
+ default: null,
+ '@media (pointer: coarse)': '24px',
+ },
flexDirection: 'column',
justifyContent: 'center',
cursor: 'pointer',