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/list-row-press-compositor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch
---

[fix] A list row's touch press release keeps fading while the page runs script, once the release has started. `ListItem`, `Item` and `TreeList` rows used to freeze mid-fade until the main thread was free, and every frame of the fade repainted the row; the release now runs on the compositor, with the same color, clock and curve as before. Script that runs in the tap's own handlers, before the next frame, still holds the row pressed until it ends. Under a finger, while a row is pressed and through its release, the press paints on the row's `::before` and the row is its own stacking context; at rest nothing of it applies, so a row's own `::before` decoration and its children's stacking are as they were. During a press the layer is the row's `::before`, and any `::before` property a caller sets, from `xstyle` (which `Item` composes after the layer) or from a stylesheet, wins over the layer's: a decoration with its own size and background jumps to the row's corner, and the row shows no pressed fill until the release ends. Decoration that should stay through a press belongs on `::after` or a child element. With a mouse or trackpad the row is unchanged: no layer and no new stacking context.

@vjeux
41 changes: 25 additions & 16 deletions docs/specs/components/List/List.spec.md

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions packages/core/src/Item/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

/**
* @file Item.tsx
* @input Uses React, ReactNode, StyleXStyles, theme tokens, useClickableContainer
* @input Uses React, ReactNode, StyleXStyles, theme tokens, useClickableContainer,
* the shared press overlays and the compositor press layer
* @output Exports Item component, ItemProps type; publishes the shared inline inset.
* Only numbered composing rows keep their start/label/end slots in one flex
* group, through Item's private exact-marker scope; other marked rows keep
Expand Down Expand Up @@ -61,6 +62,7 @@ import {useDevWarning} from '../hooks/useDevWarning';
import {themeProps} from '../utils/themeProps';
import {focusOutlineProps} from '../utils/focusOutline.stylex';
import {interactionOverlayStyles} from '../utils/interactionOverlay.stylex';
import {rowPressLayerStyles} from '../privateAttributes/press.stylex';
import {usePressFeedback} from '../hooks/usePressFeedback';
import type {ItemSwipeBridge} from './ItemSwipeLayer';

Expand Down Expand Up @@ -532,7 +534,6 @@ const styles = stylex.create({
// zoomable (WCAG 1.4.4). The hover transition keeps its own clock beside
// the transform's.
swipeRoot: {
isolation: 'isolate',
touchAction: 'pan-y pinch-zoom',
transform: `translate3d(${SWIPE_TRAVEL}, 0, 0)`,
transitionProperty: 'background-color, transform',
Expand Down Expand Up @@ -916,6 +917,10 @@ export function Item({
align === 'first-line' && styles.alignFirstLine,
isInteractive && styles.interactive,
isInteractive && interactionOverlayStyles.backgroundColor,
// The touch press on a compositor layer (after the overlay, whose
// own touch paint it turns off): the release keeps fading while
// script runs.
isInteractive && rowPressLayerStyles.cell,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styles.swipeRoot, composed after this on swipe rows (line 929), sets isolation again over cell's, which INV23 rules out ("a caller does not set those properties again on the same element"). The result matches today, but a condition later added to cell's isolation would skip swipe rows. swipeRoot's translate3d(var(--_item-swipe-travel, 0px), 0, 0) already makes the row a stacking context, so its isolation can go.

isLinkRoot && styles.linkRoot,
isHighlighted && styles.highlighted,
isSelected && styles.selected,
Expand Down
Loading
Loading