Skip to content

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

TypeScript

fix(ScrollableArea): touch screens keep the platform's scroll indicator (#8372)

Cindy Zhang24ed36dce728
diff --git a/.changeset/scrollable-area-touch-indicator.md b/.changeset/scrollable-area-touch-indicator.md
new file mode 100644
index 0000000000..8dc91d2444
--- /dev/null
+++ b/.changeset/scrollable-area-touch-indicator.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[feat] On touch screens, `ScrollableArea` keeps the platform's own scroll indicator. Its neutral `scrollbar-color` replaced iOS Safari's indicator with a faint bar that was hard to see while scrolling and also showed in the gap a pull opens; iOS now draws its own indicator, only while scrolling. Mouse and trackpad scrollbars keep the neutral colour. To keep the neutral colour on touch screens too, set `scrollbarColor` through the `xstyle` prop.
+
+@vjeux
diff --git a/packages/core/src/ScrollableArea/ScrollableArea.spec.md b/packages/core/src/ScrollableArea/ScrollableArea.spec.md
index 761840e9f1..bb4fe4499e 100644
--- a/packages/core/src/ScrollableArea/ScrollableArea.spec.md
+++ b/packages/core/src/ScrollableArea/ScrollableArea.spec.md
@@ -75,7 +75,7 @@ shared behavior hook, not the exclusive owner of that behavior.
| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | ----------------------------------- |
| FR1 | The root MUST remain the one native viewport and receive the public ref, standard container sizing props, and styling inputs through StyleX. | `spec:AST-025` IR3–IR4 | implemented |
| FR2 | The inner content wrapper MUST be a real normal-flow block box observed with the viewport, use a 100% minimum size, and use max-content inline sizing only when inline scrolling is requested. Children participate in that box rather than the viewport's flex/grid formatting context, and the minimum block size does not create a definite percentage-height basis; structures that must preserve those semantics adopt the hook directly. | `spec:AST-025` FR5–FR6 | implemented |
-| FR3 | Native scrollbar behavior MUST remain authoritative; the default thumb uses `--color-neutral`, the track is transparent, and forced colors restore platform presentation. | `spec:AST-025` FR15 | implemented |
+| FR3 | Native scrollbar behavior MUST remain authoritative; with a fine pointer the default thumb uses `--color-neutral` and the track is transparent, while a coarse primary pointer and forced colors restore platform presentation. | `spec:AST-025` FR15 | implemented |
| FR4 | Scroll-state container queries MAY enhance descendant stuck/edge presentation, but hook state MUST remain the cross-browser source of truth. | `spec:AST-025` platform support | implemented progressively |
| FR5 | The content box MUST apply and publish logical padding with edge-over-axis-over-uniform precedence, defaulting every published edge to zero. `isFullBleed` MUST let only the viewport consume inherited inset; nested content continues to read the content box's published values. | `architecture:container-padding` | implemented |
| FR6 | A fitting viewport MUST use `clip` on both physical axes so it prevents paint overflow without capturing native Sticky. Excess requested-axis geometry MUST activate the writing-mode-resolved `auto`/`hidden` pair. `stickyContainment="always"` MUST explicitly retain that pair while fitting. | `spec:AST-025` FR21 | implemented |
@@ -95,6 +95,7 @@ shared behavior hook, not the exclusive owner of that behavior.
| overflowing | named tab stop; per-axis logical edge state | one or both requested axes |
| overflow removed while focused | remove future tab stop without moving focus | current focus remains |
| forced colors | native platform scrollbar presentation | platform rendering |
+| coarse primary pointer | native platform scroll indicator | platform rendering |
### Transformation and precedence order
@@ -114,10 +115,10 @@ shared behavior hook, not the exclusive owner of that behavior.
## Design relationships
-| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
-| ---------------- | ----------------------------------------------------------------- | ------------------------ | -------------- | ------------------ |
-| Viewport | platform scrollbar with token-colored thumb and transparent track | `spec:AST-025` | supporting | FR1, FR3 |
-| Content box | no independent paint by default | caller content | structural | FR2 |
+| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
+| ---------------- | ---------------------------------------------------------------------------------- | ------------------------ | -------------- | ------------------ |
+| Viewport | platform scrollbar; with a fine pointer, token-colored thumb and transparent track | `spec:AST-025` | supporting | FR1, FR3 |
+| Content box | no independent paint by default | caller content | structural | FR2 |
### Theming anatomy
diff --git a/packages/core/src/ScrollableArea/ScrollableArea.test.tsx b/packages/core/src/ScrollableArea/ScrollableArea.test.tsx
index e3e0f75c8a..3f75946b1c 100644
--- a/packages/core/src/ScrollableArea/ScrollableArea.test.tsx
+++ b/packages/core/src/ScrollableArea/ScrollableArea.test.tsx
@@ -278,6 +278,11 @@ describe('ScrollableArea', () => {
expect(source).toContain("'@media (forced-colors: active)': 'auto'");
});
+ it("keeps the platform's own scroll indicator on touch screens", () => {
+ const source = stylesSource();
+ expect(source).toContain("'@media (pointer: coarse)': 'auto'");
+ });
+
it('guards scroll-state query containment as a progressive enhancement', () => {
const source = stylesSource();
expect(source).toContain("'@supports (container-type: scroll-state)'");
diff --git a/packages/core/src/ScrollableArea/ScrollableArea.tsx b/packages/core/src/ScrollableArea/ScrollableArea.tsx
index f122da16db..8ec4355b37 100644
--- a/packages/core/src/ScrollableArea/ScrollableArea.tsx
+++ b/packages/core/src/ScrollableArea/ScrollableArea.tsx
@@ -52,6 +52,10 @@ const styles = stylex.create({
WebkitOverflowScrolling: 'touch',
scrollbarColor: {
default: `${colorVars['--color-neutral']} transparent`,
+ // Touch screens keep the platform's own scroll indicator, which iOS
+ // shows only while scrolling, as UIScrollView does. A custom colour
+ // turns it into a faint bar that also shows in the gap a pull opens.
+ '@media (pointer: coarse)': 'auto',
'@media (forced-colors: active)': 'auto',
},
scrollbarWidth: 'auto',