Skip to content

Commit 43061c7

Browse files
vjeuxcixzhang
authored andcommitted
fix(ScrollableArea): touch screens keep the platform's scroll indicator
The viewport's neutral scrollbar-color replaced iOS Safari's own scroll indicator with a faint bar: hard to see while scrolling, and visible in the gap a pull-to-refresh opens. Under a coarse primary pointer the viewport now leaves scrollbar-color at auto, so iOS draws its indicator only while scrolling, as UIScrollView does. Mouse and trackpad scrollbars keep the neutral thumb; the component record's FR3 says so.
1 parent 4b05772 commit 43061c7

4 files changed

Lines changed: 22 additions & 5 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astryxdesign/core': patch
3+
---
4+
5+
[fix] On touch screens, `ScrollableArea` (and Table, CodeBlock and BottomSheet's body, which use it) 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.
6+
7+
@vjeux

‎packages/core/src/ScrollableArea/ScrollableArea.spec.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ shared behavior hook, not the exclusive owner of that behavior.
7575
| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | ----------------------------------- |
7676
| 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 |
7777
| 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 |
78-
| 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 |
78+
| 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 |
7979
| 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 |
8080
| 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 |
8181
| 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.
9595
| overflowing | named tab stop; per-axis logical edge state | one or both requested axes |
9696
| overflow removed while focused | remove future tab stop without moving focus | current focus remains |
9797
| forced colors | native platform scrollbar presentation | platform rendering |
98+
| coarse primary pointer | native platform scroll indicator | platform rendering |
9899

99100
### Transformation and precedence order
100101

@@ -114,10 +115,10 @@ shared behavior hook, not the exclusive owner of that behavior.
114115

115116
## Design relationships
116117

117-
| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
118-
| ---------------- | ----------------------------------------------------------------- | ------------------------ | -------------- | ------------------ |
119-
| Viewport | platform scrollbar with token-colored thumb and transparent track | `spec:AST-025` | supporting | FR1, FR3 |
120-
| Content box | no independent paint by default | caller content | structural | FR2 |
118+
| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
119+
| ---------------- | ---------------------------------------------------------------------------------- | ------------------------ | -------------- | ------------------ |
120+
| Viewport | platform scrollbar; with a fine pointer, token-colored thumb and transparent track | `spec:AST-025` | supporting | FR1, FR3 |
121+
| Content box | no independent paint by default | caller content | structural | FR2 |
121122

122123
### Theming anatomy
123124

‎packages/core/src/ScrollableArea/ScrollableArea.test.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ describe('ScrollableArea', () => {
278278
expect(source).toContain("'@media (forced-colors: active)': 'auto'");
279279
});
280280

281+
it("keeps the platform's own scroll indicator on touch screens", () => {
282+
const source = stylesSource();
283+
expect(source).toContain("'@media (pointer: coarse)': 'auto'");
284+
});
285+
281286
it('guards scroll-state query containment as a progressive enhancement', () => {
282287
const source = stylesSource();
283288
expect(source).toContain("'@supports (container-type: scroll-state)'");

‎packages/core/src/ScrollableArea/ScrollableArea.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ const styles = stylex.create({
5252
WebkitOverflowScrolling: 'touch',
5353
scrollbarColor: {
5454
default: `${colorVars['--color-neutral']} transparent`,
55+
// Touch screens keep the platform's own scroll indicator, which iOS
56+
// shows only while scrolling, as UIScrollView does. A custom colour
57+
// turns it into a faint bar that also shows in the gap a pull opens.
58+
'@media (pointer: coarse)': 'auto',
5559
'@media (forced-colors: active)': 'auto',
5660
},
5761
scrollbarWidth: 'auto',

0 commit comments

Comments
 (0)