Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/scrollable-area-touch-indicator.md
Original file line number Diff line number Diff line change
@@ -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
11 changes: 6 additions & 5 deletions packages/core/src/ScrollableArea/ScrollableArea.spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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

Expand All @@ -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

Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/ScrollableArea/ScrollableArea.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)'");
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/ScrollableArea/ScrollableArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Loading