Skip to content

fix(HoverCard): text written around an expression gets the focusable trigger and hover cue - #9603

Merged
cixzhang merged 8 commits into
mainfrom
lane4/hovercard-mixed-text
Nov 3, 2026
Merged

cixzhang merged 8 commits into
mainfrom
lane4/hovercard-mixed-text

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A product writes a hover card around text with an expression in it, such as <HoverCard content={history}>Edited {when}</HoverCard>. That text gets no trigger:

  • Hover and keyboard focus never open the card.
  • It's not a tab stop, and it carries no popup attributes or description, so screen-reader and keyboard users can't find the card at all.
  • It shows no hover cue, unlike <HoverCard>Edited</HoverCard>.

Problem and solution fit

  • Why does it fail? HoverCard wraps text children in a focusable inline span, but isTextOnly accepted only a single string or number. JSX passes Edited {when} as an array of strings, so HoverCard treated it as element children and looked for a first element to attach to. There isn't one.
  • Why does it harm the task? The card's content (who edited, when) becomes unreachable.
  • Why does it matter? Interpolated text is the most ordinary way to write a text trigger.

Expected behavior and authority

  • component:HoverCard FR2: text children are wrapped in a focusable inline span. The record lists "Mixed text children get no trigger" under Current-state impact.
  • FR8: Specs ruled that hasHoverIndication's auto covers the same text children, "strings and numbers, with holes such as false and null ignored".

Smallest restoration

  • isTextOnly also accepts an array (flattened) whose renderable items, per the shared isRenderable, are all strings or numbers, with at least one present. One element still means element children. There's no Children introspection.
  • Record:
    • FR2 and FR8 use the same wording for text children.
    • The Current-state bullet is dropped, and the readiness count goes from seven gaps to six.
    • HoverCard.doc.mjs (the children and hasHoverIndication entries, full and dense, both languages) and the hasHoverIndication JSDoc describe text children the same way.
    • The FR1/FR2/FR8 verification row names the mixed-text and hover-cue tests.

Evidence

  • Reproduction before the change: these new tests fail on main:
    • Edited {when} gets the focusable span, its description, and hover opening;
    • holes are ignored;
    • the hover cue matches a single string's.
  • Result after the change: they pass.
  • Representative unchanged path:
    • A child with one element (Edited <time>today</time>) still wires that element.
    • hasHoverIndication={false} still removes the cue.
    • The whole HoverCard suite passes (70 tests).
  • Regression test or other mutation-sensitive proof: reverting isTextOnly fails the wrap, holes and cue tests.

Scope

  • One defect is restored: text written around an expression is a text trigger.
  • Separable contradictory or unsettled tagalongs were removed or split. Tooltip's same check isn't touched.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label. The cue is FR8's existing auto cue, applied to the text children FR2 already covers.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm vitest run packages/core/src/HoverCard: 70 passed.
  • pnpm check:knowledge: aligned.
  • The cue is a class identical to a single string's trigger (asserted), so its pixels match the existing text trigger.

Writing rubric results

Run over FR2, FR8, Current-state impact, and the FR1/FR2/FR8 verification row (docs/contributing/spec-writing.md):

  • Present tense, describes the system: yes.
  • One owner per fact: FR2 owns wrapping and FR8 owns the cue, and both use the same definition of text children.
  • Testable: both name observable outcomes, and the row names the tests.

…trigger

component:HoverCard FR2: text children are wrapped in a focusable inline
span. isTextOnly accepted only a single string or number, so text that
reaches React as several strings (`Edited {when}`) was treated as element
children; the wrapper found no element to attach to, and hover and focus
never opened the card.

isTextOnly now also accepts an array whose renderable items are all strings
or numbers (holes that render nothing, per isRenderable, are skipped); one
element still means element children. No Children introspection. Tests:
mixed text wraps and opens (red before), holes are ignored, and a present
element still takes the wiring. Record: FR2 states it, the Current-state
bullet is dropped, and the verification row names the tests.
…d an expression

Specs' ruling: FR8's hasHoverIndication auto applies to text children,
strings and numbers with holes such as false and null ignored, the same set
FR2 wraps. The trigger already took the cue from isTextOnly; tests now pin
that several text children, and text with holes, get the same cue class as
one string, and that hasHoverIndication={false} removes it. Record: FR8 and
FR2 use the same wording, and the verification row names the cue.
@vercel

vercel Bot commented Nov 2, 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 3, 2026 3:51pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 3, 2026, 4:05 PM UTC

@cixzhang

cixzhang commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 2408c09

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

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@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.

The fix works: text written around an expression, such as Edited {when}, now gets the focusable trigger, opens on hover and keyboard focus, and shows the same hover cue as a single string, and the new tests fail without the change. Before this merges, please update the documentation that still describes the old behaviour:

  • HoverCard.doc.mjs (the children and hasHoverIndication entries, in both the full and the dense docs) and the hasHoverIndication JSDoc in HoverCard.tsx still say such text gets no trigger, or that auto covers only a single string or number.
  • The Compatibility/readiness row of HoverCard.spec.md still counts "eight further implementation gaps"; with the mixed-text bullet removed, seven remain.

[Automated review]

CodeBunny on #9603: HoverCard.doc.mjs (children and hasHoverIndication, full
and dense docs, both languages) and the hasHoverIndication JSDoc still said
text in several pieces gets no trigger, or that auto covers only a single
string or number. They now describe text children with holes ignored, as
FR2 and FR8 do, and the readiness count drops to seven gaps.
@cixzhang

cixzhang commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 6ec4de8

@github-actions github-actions Bot added needs:spec-owner-review Current knowledge records await owner approval and removed needs:spec-owner-review Current knowledge records await owner approval labels Nov 2, 2026

@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.

Approving: text written around an expression, such as Edited {when}, now gets the focusable trigger, opens on hover and keyboard focus, and shows the same hover cue as a single string, the new tests fail without the change, and the documentation and gap count flagged earlier are fixed. One optional cleanup: the verification map in HoverCard.spec.md still lists hasHoverIndication={false} and the default cue as having no unit test, which the new cue test now covers.

[Automated review]

…vercard-mixed-text

# Conflicts:
#	docs/specs/components/HoverCard/HoverCard.spec.md
The previous merge commit cut the HoverCard record from the removed
Current-state bullet to the next list item, which dropped whole sections.
The record is main's again, with only this PR's edits: FR2, FR8, the
FR1/FR2/FR8 verification row, the removed mixed-text gap and its count.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 3, 2026
@cixzhang

cixzhang commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 62c6cd9

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 3, 2026

@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.

Requesting one small change before merge. Text written around an expression, such as Edited {when}, now gets the focusable trigger, opens on hover and keyboard focus, and shows the same hover cue as a single string, and the new tests fail without the fix.

  • HoverCard.spec.md still says under Compatibility and migration that there is "no public prop, default, DOM, or styling change", but triggers written around an expression now render a focusable span with the dashed underline, so that line should state this effect (a patch [fix]).

Optional: the verification map still lists hasHoverIndication={false} and the default cue as having no unit test, which the new cue test now covers.

[Automated review]

| End-user impact | Mouse, keyboard, and touch users can open the preview, move into it to use its actions, and dismiss it; screen-reader users hear it as a named popup dialog or as the trigger's description. Under the default `touchTrigger="auto"`, a tap on a trigger that performs an action performs only that action. |
| Builder impact | `touchTrigger` answers whether it is safe to consume a tap to show the card (DEC-1): keep the default `auto` on a trigger that performs an action, pass `tap` where a tap only reveals the card, and pass `none` where a tap must never show it. |
| Compatibility/readiness | No public API change: `touchTrigger` keeps its released values and its default `auto`. Seven implementation gaps (see Current-state impact). |
| Compatibility/readiness | No public API change: `touchTrigger` keeps its released values and its default `auto`. Six implementation gaps (see Current-state impact). |

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.

The gap count is updated here, but the Compatibility class bullet under Compatibility and migration (line 66) still says "no public prop, default, DOM, or styling change". Text written around an expression now renders a focusable span with the dashed underline, so that bullet should say so, for example: "no public prop or default change; text written around an expression now renders the focusable trigger span and the auto hover cue, a patch [fix]".

… change; evidence lists follow the new cue test

CodeBunny on #9603: text written around an expression now renders the
focusable trigger span with the hover cue, so the Compatibility class line
says so. The new cue test covers hasHoverIndication={false} and the default
cue, so the read-from-source and browser-only lists drop them.
@cixzhang

cixzhang commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 2c81855

@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.

Approving. Text written around an expression, such as Edited {when}, now gets HoverCard's focusable trigger, opens on hover and keyboard focus, and shows the same hover cue as a single string, and the new tests fail without the fix. The record's compatibility class and verification lists now describe the change accurately, so nothing further is needed for review.

[Automated review]

# Conflicts:
#	docs/specs/components/HoverCard/HoverCard.spec.md
#	packages/core/src/HoverCard/HoverCard.test.tsx
#	packages/core/src/HoverCard/HoverCard.tsx
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 3, 2026
@cixzhang

cixzhang commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 581f749

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 3, 2026

@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.

Approving: text written around an expression, such as Edited {when}, now gets HoverCard's focusable trigger, opens on hover and keyboard focus, carries its popup attributes or description, and shows the same hover cue as a single string. The new tests fail without the fix and pass with it, the record and consumer docs describe the change, and the merge of main kept the fix intact.

[Automated review]

@cixzhang
cixzhang marked this pull request as ready for review November 3, 2026 16:06
@cixzhang
cixzhang merged commit ba64010 into main Nov 3, 2026
149 checks passed
@github-actions
github-actions Bot deleted the lane4/hovercard-mixed-text branch November 4, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 581f7496 Deployed Nov 3, 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