Skip to content

fix(ClickableCard, SelectableCard): a mouse press on a control inside the card shows no card press (draft, for decision) - #9930

Closed
cixzhang wants to merge 1 commit into
lane4/clickable-nested-pressfrom
lane4/clickable-nested-press-mouse
Closed

cixzhang wants to merge 1 commit into
lane4/clickable-nested-pressfrom
lane4/clickable-nested-press-mouse

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Draft, stacked on #9801. Waiting for the owner's decision; don't merge.

What it decides

#9801 ships the touch half: a finger press that starts on a control inside a ClickableCard or SelectableCard shows no card press. This pull request adds the mouse half. A primary mouse or pen press that starts on a nested control (the "i", a button, a link) shows no card press either. The card stays at rest instead of showing its pressed overlay. A press on the card itself still looks pressed, and keyboard is unchanged.

How

  • useClickableContainer's onPointerDown: for a primary mouse or pen press on a nested control, it marks the container (privateAttributes/nestedPress.stylex.ts, cleared at the press's end through Core's shared input stream). A finger press still cancels the press controller's paint.
  • The cards: their :active press colour, nestedPressStyles.cardPressOverlay in that owner module, leaves out a marked card.
  • The pressableCoverage guard: it counts only files that compose a styles module's stylex.create exports, since useClickableContainer imports only the marking function. A case pins which imports count.
  • Records: ClickableCard FR5 and SelectableCard FR4 read "a touch or mouse press".
  • Changeset: patch [fix].

Evidence

Real Chrome, 1024 px, mouse, main versus this branch:

  • mouse down on the "i": pressed (10%) versus no card press;
  • mouse down on the card text: pressed versus pressed;
  • Enter on the "i": no card press in both.

Owner: fix-loop lane 4. Land path: Held for the owner's decision card; then the drain merges after the normal gates.

… the card shows no card press

The desktop half of the nested-press rule. A primary mouse or pen press that
starts on a nested control marks the container (privateAttributes/
nestedPress.stylex.ts), and the cards' :active arm leaves out a marked card.
The pressableCoverage guard counts only files that compose a styles module's
stylex.create exports, since useClickableContainer imports only the marking
function.
@vercel

vercel Bot commented Nov 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 4, 2026 10:11am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 4, 2026
@astracat-bot

astracat-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Nov 4, 2026, 10:39 AM UTC

@astracat-bot astracat-bot Bot left a comment

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.

This needs an engineering owner's decision before it can be approved, and one code fix.

The pull request rewords ClickableCard FR5 and SelectableCard FR4 so that a mouse press starting on a control inside the card shows no card press, while the current records say the card paints its pressed overlay for mouse and touch presses. An engineering owner records the decision by commenting /approve-spec 96def65885f51205922794a1621d901f7f0d1080 on this pull request, and the author may do so as an engineering owner; what must be settled is whether the desktop mouse rule ships for both cards, and whether Item delegated rows and TreeList link rows follow.

Blocking:

  • Desktop behavior change needs an owner decision: the mouse and pen mark in useClickableContainer.ts (lines 352-356) with the cards' new :active:not([data-astryx-nested-press]) arm changes what a mouse press paints for every desktop user, so either gate it to touch input or cite the decision in the description.
  • A pen press, or a mouse press on a touch-first device, that starts on a nested control still paints the whole card pressed because the hook cancels the press controller only for touch, so call cancelPress for every pointer type (marking only mouse and pen) with tests for both cases, or narrow the changeset, description and FR wording to a mouse under a fine pointer.

Non-blocking: the comment at useClickableContainer.ts lines 330-333 says the container's :active arm skips a marked container, which holds only for the two cards.

[Automated review]

Comment on lines +352 to +356
if (event.pointerType === 'touch') {
cancelPress(containerEl);
} else {
markNestedPress(containerEl);
}

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.

A pen press, or a mouse press where the primary pointer is coarse, is painted by the press controller (pressFeedback.ts sends every non-mouse pointer to its finger slot, and paints a mouse press when the stylesheet drops :active). The mark only removes the :active arm, so the card still shows data-astryx-press="on" for those presses. Cancelling for every pointer type covers them:

cancelPress(containerEl);
if (event.pointerType !== 'touch') {
  markNestedPress(containerEl);
}

A pen case and a coarse-pointer mouse case in ClickableCard.nestedPress.test.tsx would pin it.

Comment on lines +330 to +333
// The press-state counterpart of onClick's rule: a press that would not
// activate the container shows no press on it. A finger press cancels the
// press controller's paint. A mouse or pen press marks the container, and
// the container's `:active` arm leaves out a marked container.

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: only ClickableCard and SelectableCard read the mark; Item and TreeList rows still paint :active, and pen paint comes from the controller. A shorter comment that keeps the reason:

// A press that starts on a nested control does not activate the container,
// so the container shows no press. Cancel the controller's press. A card's
// `:active` arm skips a container marked for a mouse or pen press.

@github-actions
github-actions Bot deleted the branch lane4/clickable-nested-press November 5, 2026 06:03
@cixzhang

Copy link
Copy Markdown
Contributor Author

(Posted by Cindy's agent.) Closing: already decided by the current ClickableCard record. FR5 keeps the card's :active paint for a mouse press on a nested control (a touch press there shows none, since it doesn't activate the card), so this change would contradict it.

@cixzhang cixzhang closed this Nov 16, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

(Posted by Cindy's agent.) Reopened: I closed this in error. It's the B option of an open owner question (keep main's press model, or adopt this behavior), so it stays open until that question is answered.

This branch was successfully deployed

1 active deployment
Preview — 96def658 Deployed Nov 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant