Skip to content
Draft
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fcd23bd
docs(architecture): press feedback has one engine and three recipes
cixzhang Nov 16, 2026
854a0e9
docs(architecture): press feedback review fixes (per-recipe tracking,…
cixzhang Nov 16, 2026
5e54d73
docs(architecture): press feedback states the stretched-control gap o…
cixzhang Nov 16, 2026
f48376d
docs(architecture): press feedback scopes INV7 to non-activating pres…
cixzhang Nov 16, 2026
c251ce2
docs(architecture): a stretched control keeps its press paint on its …
cixzhang Nov 16, 2026
2eff03c
docs(architecture): press feedback scopes drift rules to untracked pr…
cixzhang Nov 16, 2026
3eaca16
docs(architecture): press feedback keeps interaction-modality INV13's…
cixzhang Nov 16, 2026
4ef2cbf
docs(architecture): the surface under the finger paints (owner rule);…
cixzhang Nov 16, 2026
cec54c6
docs(architecture): press feedback names who writes a group press, an…
cixzhang Nov 16, 2026
a860b7b
docs(architecture): the menu profile names useMenuPress's own modules
cixzhang Nov 16, 2026
54b636e
Merge origin/main
cixzhang Nov 16, 2026
68a13eb
docs: the surface under the finger paints for every pointer in Item, …
cixzhang Nov 16, 2026
57d537b
docs: verification rows cover every pointer for nested presses in Ite…
cixzhang Nov 16, 2026
3273e63
docs: press feedback timing goes through the press-feedback engine (r…
cixzhang Nov 16, 2026
50ba22c
docs(press-feedback): name the pen and CheckboxList rows in the neste…
cixzhang Nov 17, 2026
f855ddb
Merge remote-tracking branch 'origin/main' into specs/press-feedback-…
cixzhang Nov 17, 2026
7fe942b
docs(press-feedback): keep the tested CheckboxList, RadioList and Tok…
cixzhang Nov 17, 2026
8e57323
docs(Token): name the untested end-content press in the FR6 gap
cixzhang Nov 17, 2026
adeaa5d
docs(cards): a mouse press keeps desktop timing; where any press pain…
cixzhang Nov 17, 2026
e3da183
docs(press-feedback): state the owner's paint rule in neutral words
cixzhang Nov 17, 2026
fc12fff
Merge remote-tracking branch 'origin/main' into l0/container-nested-p…
cixzhang Nov 17, 2026
1e0afc2
docs(press-feedback): Decider line with the decision time
cixzhang Nov 17, 2026
8848813
fix(press): a press on a control inside a card, row or token paints o…
cixzhang Nov 17, 2026
d9364bd
Merge remote-tracking branch 'origin/specs/press-feedback-recipes' in…
cixzhang Nov 17, 2026
3270bc6
docs(press-feedback): a Space key press paints until release; Enter, …
cixzhang Nov 17, 2026
c47a8f8
Merge remote-tracking branch 'origin/main' into l0/container-nested-p…
cixzhang Nov 17, 2026
66888dc
docs(ClickableCard, SelectableCard, Item, TreeList, Token): the neste…
cixzhang Nov 17, 2026
8b27ee4
docs(press-feedback): record that a held Space on a container's own a…
cixzhang Nov 17, 2026
62e8b70
docs(useClickableContainer, Token): the onPointerDown docs and Token'…
cixzhang Nov 17, 2026
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/nested-control-press-every-pointer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch
---

[fix] A mouse or pen press on a control inside a ClickableCard, SelectableCard, Item row, TreeList row or Token now paints only that control, as a finger's press already did. The container keeps its hover look and shows no pressed state. A press on the container's own surface still paints the container, and an Item row whose root is a link still paints, because a press there runs the row.

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.

Non-blocking: Token's Remove button has no press paint of its own, so after this change a mouse press on it shows no press anywhere; "now paints only that control" reads as if Remove lights up. "shows no pressed state on the container" matches what ships.


@cixzhang
94 changes: 94 additions & 0 deletions apps/storybook/stories/NestedControlPress.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.

/**
* @file NestedControlPress.stories.tsx
* @input ClickableCard, SelectableCard, Item, TreeList, Token and Button from
* @astryxdesign/core
* @output One story with each container that holds a nested control: a
* ClickableCard and a SelectableCard with a Button, an Item row and a
* TreeList row with an end-content Button, and a Token with a remove
* button, and a standalone Button. A press on the nested control paints
* only that control; a press on the container's own surface paints the
* container
* @position Fixture for __tests__/NestedControlPress.a11y.chromium.spec.ts
*/

import type {ReactNode} from 'react';
import type {Meta, StoryObj} from '@storybook/react';
import {ClickableCard} from '@astryxdesign/core/ClickableCard';
import {SelectableCard} from '@astryxdesign/core/SelectableCard';
import {Item} from '@astryxdesign/core/Item';
import {TreeList} from '@astryxdesign/core/TreeList';
import {Token} from '@astryxdesign/core/Token';
import {Button} from '@astryxdesign/core/Button';
import {Text} from '@astryxdesign/core/Text';
import {VStack} from '@astryxdesign/core/Layout';

const meta: Meta = {
title: 'Core/Nested Control Press',
tags: ['no-visual'],
parameters: {layout: 'padded'},
};
export default meta;

type Story = StoryObj;

function Case({id, children}: {id: string; children: ReactNode}) {
return (
<div data-testid={id} style={{width: 320}}>
{children}
</div>
);
}

function NestedButton() {
return <Button label="Nested" size="sm" onClick={() => {}} />;
}

export const Containers: Story = {
render: () => (
<VStack gap={4}>
<Case id="clickable-card">
<ClickableCard label="Open billing" onClick={() => {}}>
<VStack gap={2}>
<Text type="body">Billing summary</Text>
<NestedButton />
</VStack>
</ClickableCard>
</Case>
<Case id="selectable-card">
<SelectableCard label="Plan" isSelected={false} onChange={() => {}}>
<VStack gap={2}>
<Text type="body">Team plan</Text>
<NestedButton />
</VStack>
</SelectableCard>
</Case>
<Case id="item">
<Item
label="Open row"
onClick={() => {}}
endContent={<NestedButton />}
/>
</Case>
<Case id="tree-list">
<TreeList
items={[
{
id: 'row',
label: 'Open tree row',
onClick: () => {},
endContent: <NestedButton />,
},
]}
/>
</Case>
<Case id="token">
<Token label="Filter token" onClick={() => {}} onRemove={() => {}} />
</Case>
<Case id="button">
<Button label="Standalone" onClick={() => {}} />
</Case>
</VStack>
),
};
21 changes: 12 additions & 9 deletions docs/architecture/press-feedback.md

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions docs/specs/components/ClickableCard/ClickableCard.spec.md

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions docs/specs/components/Item/Item.spec.md

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions docs/specs/components/SelectableCard/SelectableCard.spec.md

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions docs/specs/components/Token/Token.spec.md

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions docs/specs/components/TreeList/TreeList.spec.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* that would activate it: a press that starts on an interactive element
* inside the card (an InfoTip, a button, a link) paints no press on the
* card for a finger; a press on the card's own surface still paints. A
* mouse press keeps its `:active` paint (checked in a real browser)
* mouse's and a pen's press follow the same rule
* (__tests__/nestedControlPress.test.tsx)
* @position Testing; validates useClickableContainer's pointerdown callback
* through ClickableCard
*/
Expand Down
19 changes: 17 additions & 2 deletions packages/core/src/ClickableCard/ClickableCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,34 @@ const styles = stylex.create({
// stylesheet and a flat one alike. A custom property's attribute arm
// does not: a layered build emits the property's default outside the
// priority layers its attribute arms land in, and the default wins.
// A press that starts on a control inside the card sets
// `--_nested-press-paint` on the card (useClickableContainer), so the
// card paints its rest overlay, not a mouse press. A card inside resets it.
'--_nested-press-paint': 'initial',
'--_nested-press-rest': {
default: 'transparent',
':where(:not(:disabled,[aria-disabled="true"]))': {
default: null,
'@media (hover: hover)': {
default: null,
':hover:where(:not(:disabled,[aria-disabled="true"]))':
colorVars['--color-overlay-hover'],
},
},
},
'--_press-overlay': {
default: 'transparent',
':where(:not(:disabled,[aria-disabled="true"]))': {
default: null,
':active': {
default: colorVars['--color-overlay-pressed'],
default: `var(--_nested-press-paint, ${colorVars['--color-overlay-pressed']})`,
'@media (pointer: coarse)': 'transparent',
},
'@media (hover: hover)': {
default: null,
':hover:where(:not(:disabled,[aria-disabled="true"]))':
colorVars['--color-overlay-hover'],
':active': colorVars['--color-overlay-pressed'],
':active': `var(--_nested-press-paint, ${colorVars['--color-overlay-pressed']})`,
},
},
},
Expand Down
19 changes: 17 additions & 2 deletions packages/core/src/SelectableCard/SelectableCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,34 @@ const styles = stylex.create({
// stylesheet and a flat one alike. A custom property's attribute arm
// does not: a layered build emits the property's default outside the
// priority layers its attribute arms land in, and the default wins.
// A press that starts on a control inside the card sets
// `--_nested-press-paint` on the card (useClickableContainer), so the
// card paints its rest overlay, not a mouse press. A card inside resets it.
'--_nested-press-paint': 'initial',
'--_nested-press-rest': {
default: 'transparent',
':where(:not(:disabled,[aria-disabled="true"]))': {
default: null,
'@media (hover: hover)': {
default: null,
':hover:where(:not(:disabled,[aria-disabled="true"]))':
colorVars['--color-overlay-hover'],
},
},
},
'--_press-overlay': {
default: 'transparent',
':where(:not(:disabled,[aria-disabled="true"]))': {
default: null,
':active': {
default: colorVars['--color-overlay-pressed'],
default: `var(--_nested-press-paint, ${colorVars['--color-overlay-pressed']})`,
'@media (pointer: coarse)': 'transparent',
},
'@media (hover: hover)': {
default: null,
':hover:where(:not(:disabled,[aria-disabled="true"]))':
colorVars['--color-overlay-hover'],
':active': colorVars['--color-overlay-pressed'],
':active': `var(--_nested-press-paint, ${colorVars['--color-overlay-pressed']})`,
},
},
},
Expand Down
Loading