diff --git a/.changeset/nested-control-press-every-pointer.md b/.changeset/nested-control-press-every-pointer.md new file mode 100644 index 0000000000000..28f4fd892cc49 --- /dev/null +++ b/.changeset/nested-control-press-every-pointer.md @@ -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. + +@cixzhang diff --git a/apps/storybook/stories/NestedControlPress.stories.tsx b/apps/storybook/stories/NestedControlPress.stories.tsx new file mode 100644 index 0000000000000..130e24302d6bb --- /dev/null +++ b/apps/storybook/stories/NestedControlPress.stories.tsx @@ -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 ( +