Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
There was a problem hiding this comment.
Not ready yet: one owner decision and three fixes remain. An engineering owner needs to decide whether @astryxdesign/core should publish the new HoverCardPressTrigger and TooltipPressTrigger types, which no current record names; any engineering owner, the author included, can record that by commenting /approve-spec <full head SHA>.
- With
focusTrigger="never", a pinned card or tooltip stays open after focus moves away, contrary to FR9; letting the shared press pin listen forfocusouton the trigger it wires fixes both components. - The diff still contains the unmerged #9232, so land it first and rebase until this pull request holds only the HoverCard change.
- Both changesets say the press stops at the trigger for
useHoverCardanduseTooltiptoo, but with the hooks a plainonClickrow still receives it.
[Automated review]
| const handleFocusOut = useCallback( | ||
| (e: FocusEvent) => { | ||
| // A pinned card closes when focus leaves the trigger and the card. | ||
| if (handlePressFocusLeave(e)) { |
There was a problem hiding this comment.
This is the only way a pinned card learns that focus left, but the focusout listener that calls it is attached only when focusTrigger is always, or auto on a focusable trigger (lines 619-625). With focusTrigger="never", pressing Tab after pinning leaves the card open with aria-expanded="true", contrary to FR9's "focus moving outside them closes it". useTooltip.tsx:581-585 has the same gating.
| } | ||
| return; | ||
| } | ||
| element.addEventListener('click', handlePress); |
There was a problem hiding this comment.
Suggest wiring focusout here too, beside click and keydown, so the pin closes on focus leaving whatever the host's focusTrigger is, and the hosts can drop their trigger-side handlePressFocusLeave calls.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [feat] HoverCard (and `useHoverCard`) take `pressTrigger` (type `HoverCardPressTrigger`): `none` (the default, unchanged) or `toggle`. With `toggle` on a button trigger, a click, a tap, Enter, or Space pins the card open and the same press closes it, while hover and focus still preview it. A pinned card stays until Escape, a second press, a press outside, or focus leaving; a press on its own content keeps it, and it takes Escape before the layer beneath it. The press stops at its trigger, so a clickable row, card, or label around it does nothing, and the trigger's own handlers still run. The trigger reports `aria-expanded` and `aria-controls`, and the card's `label` (else its text) is announced once when it pins, inside a modal too (`component:HoverCard` FR9 and FR10). On a trigger that is not a button, a labelled card keeps its own popup state and tap-only opening; beside `pressTrigger="toggle"`, `touchTrigger` is ignored. |
There was a problem hiding this comment.
"The press stops at its trigger, so a clickable row, card, or label around it does nothing" holds for the HoverCard component. It does not hold for useHoverCard, where a plain onClick row still receives the press (as useHoverCard.doc.mjs says). Suggest scoping this sentence to the component.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [feat] Tooltip (and `useTooltip`) take `pressTrigger` (type `TooltipPressTrigger`): `none` (the default, unchanged) or `toggle`. With `toggle` on a button trigger, a click, a tap, Enter, or Space pins the tooltip open and the same press closes it, while hover and focus still preview it. A pinned tooltip stays until Escape, a second press, a press outside, or focus leaving, and it takes Escape before the layer beneath it. The press stops at its trigger, so a clickable row, card, or label around it does nothing, and the trigger's own handlers still run. The trigger reports `aria-expanded` and `aria-controls`, and the tooltip's text is announced once when it pins, inside a modal too (`component:Tooltip` FR9 and FR10). A trigger that is not a button gets a development warning and keeps tap-only opening; beside `pressTrigger="toggle"`, `touchTrigger` is ignored. |
There was a problem hiding this comment.
Same here: useTooltip callers inside a plain onClick row still get the row's click on a pinning press, and only the Tooltip component stops it.
36b7102 to
5015adf
Compare
There was a problem hiding this comment.
Not ready yet: two engineering-owner decisions and four fixes remain. An engineering owner needs to approve or reject the new anchorRef exception this pull request writes into component:Tooltip FR9 (current FR9 says a pinning press never reaches a row or container around the trigger), and to decide whether @astryxdesign/core should publish HoverCardPressTrigger and TooltipPressTrigger; any engineering owner, the author included, can record approval by commenting /approve-spec <full head SHA>.
- Land #9232 first and rebase, so this pull request holds only the HoverCard change instead of 2,716 authored lines.
- Both changesets say the press stops at the trigger for
useHoverCardanduseTooltiptoo, but a plainonClickrow around a bare hook trigger still activates; scope that sentence to the components. - A controlled labelled HoverCard announces its label as soon as a press asks it to open, even when the owner keeps it closed; announce only once it pins.
- Add HoverCard stop cases inside a ClickableCard, an Item row and a
<label>, which its verification row now claims.
[Automated review]
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [feat] HoverCard (and `useHoverCard`) take `pressTrigger` (type `HoverCardPressTrigger`): `none` (the default, unchanged) or `toggle`. With `toggle` on a button trigger, a click, a tap, Enter, or Space pins the card open and the same press closes it, while hover and focus still preview it. A pinned card stays until Escape, a second press, a press outside, or focus leaving; a press on its own content keeps it, and it takes Escape before the layer beneath it. The press stops at its trigger, so a clickable row, card, or label around it does nothing, and the trigger's own handlers still run. The trigger reports `aria-expanded` and `aria-controls`, and the card's `label` (else its text) is announced once when it pins, inside a modal too (`component:HoverCard` FR9 and FR10). On a trigger that is not a button, a labelled card keeps its own popup state and tap-only opening; beside `pressTrigger="toggle"`, `touchTrigger` is ignored. |
There was a problem hiding this comment.
"The press stops at its trigger, so a clickable row, card, or label around it does nothing" holds for the HoverCard component. With the bare useHoverCard hook a plain onClick row still receives the press (as useHoverCard.doc.mjs says). Suggest scoping this sentence to the component and saying what a hook caller does.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [feat] Tooltip (and `useTooltip`) take `pressTrigger` (type `TooltipPressTrigger`): `none` (the default, unchanged) or `toggle`. With `toggle` on a button trigger, a click, a tap, Enter, or Space pins the tooltip open and the same press closes it, while hover and focus still preview it. A pinned tooltip stays until Escape, a second press, a press outside, or focus leaving, and it takes Escape before the layer beneath it. The press stops at its trigger, so a clickable row, card, or label around it does nothing, and the trigger's own handlers still run. With `anchorRef`, Tooltip renders nothing around the trigger to stop it: the anchor's own `onClick` runs, Astryx clickable rows, cards, and containers ignore the press, and a plain `onClick` element around the anchor receives it unless the anchor's `onClick` stops it. The trigger reports `aria-expanded` and `aria-controls`, and the tooltip's text is announced once when it pins, inside a modal too (`component:Tooltip` FR9 and FR10). A trigger that is not a button gets a development warning and keeps tap-only opening; beside `pressTrigger="toggle"`, `touchTrigger` is ignored. |
There was a problem hiding this comment.
Same for useTooltip: a plain onClick row around a bare hook trigger still gets the pinning press; only the Tooltip component stops it at a child trigger.
| if (current.isOpen !== undefined) { | ||
| if (!current.isOpen) { | ||
| armOutsideDismiss(); | ||
| announceName(); |
There was a problem hiding this comment.
For a controlled layer this announces the label before the owner answers onOpenChange(true). If the owner keeps isOpen={false}, a screen-reader user hears the card's name while nothing opens and the trigger says aria-expanded="false". FR10 announces it "when the card pins"; consider announcing once the controlled card actually shows pinned, with a test where the owner declines.
| | FR6 | Escape closes a visible tooltip; Escape during text composition is ignored. Escape routing follows `family:overlay-dismissal`: a visible topmost tooltip in the page handles that Escape, so a layer underneath stays open for that press. Implementation gap: a tooltip rendered into another document, such as an iframe or a Picture-in-Picture window, with no layer beneath it is never closed by Escape (Current-state impact). `spec:AST-003` FR4, accepted and not yet implemented, makes an unpinned tooltip passive and gives a pinned one Escape first (Current-state impact). Outside `pressTrigger="toggle"`, pressing an uncontrolled tooltip's trigger closes it; a press that focuses a text-entry trigger reopens it through FR4. | WCAG 1.4.13; tests | | ||
| | FR7 | `isOpen` forces the tooltip shown or hidden, and `isOpen={true}` suppresses hover and focus hiding; a controlled tooltip answers Escape by calling `onOpenChange(false)` without hiding, and is not closed by pressing the trigger. `isDefaultOpen` opens it on mount, still dismissible. Implementation gap: with `isOpen={false}`, any focus FR4 opens on, keyboard focus or a click into a text-field trigger, still opens the tooltip and reports `onOpenChange(true)`, and Escape then only reports `onOpenChange(false)`, so it stays until focus or the pointer leaves the trigger or the tooltip, or the caller re-renders with a new `onOpenChange` (Current-state impact). `isEnabled={false}` disables triggers and drops a pending open. | Current source and tests | | ||
| | FR8 | `onOpenChange` reports each show and hide. `hasHoverIndication` (`auto`: a single string or number child) adds a hover cue to the inline trigger. | Current source and tests | | ||
| | FR9 | With `pressTrigger="toggle"` and a trigger whose role is `button` (a `<button>` or `role="button"`), a click, a completed tap, Enter, or Space on the trigger pins the tooltip open, and the same press on a pinned tooltip closes it. Hover and keyboard focus still preview it per FR3 and FR4; on touch no preview opens and a tap pins it, while a touch that becomes a scroll pins nothing. A pinned tooltip stays open when the pointer leaves the trigger and the surface; Escape (FR6), a second press, a press outside the trigger and the surface, or focus moving outside them closes it. In a controlled tooltip a press reports the toggled value through `onOpenChange` and does not change the state itself (FR7). A press that pins or closes the layer stops at its trigger: it does not reach a clickable row, card, or container around it, or the control a label names. With `anchorRef`, the caller's own handlers still receive the press: the anchor's `onClick` runs, and a plain `onClick` element around the anchor receives it unless the anchor's `onClick` stops it; Astryx clickable rows, cards, and containers ignore it. A trigger whose role is not `button` gets a development warning and keeps tap-only opening: a tap opens the tooltip as `touchTrigger="tap"` does, and no press pins it. A trigger whose tooltip repeats its own visible text, such as a truncated Text that is its own tab stop, may take `pressTrigger="toggle"` without being a button: a press pins it as on a button trigger, and it gets no development warning, no `aria-expanded` or `aria-controls`, and no announcement, since its text is already its content. Implementation gap: no component reaches the own-text clause yet (Current-state impact). | DEC-1; WCAG 1.4.13, 2.1.1 | |
There was a problem hiding this comment.
The added anchorRef sentence relaxes current FR9 ("does not reach a clickable row, card, or container around it"). That is a requirement change, so it needs an engineering owner's approval (/approve-spec <full head SHA>) or the anchored Tooltip has to stop the press as FR9 says today.
| | FR3, AR1 | `HoverCard.test.tsx` role and trigger-attribute tests | Labelled and unlabelled; supported and unsupported roles | Wrong role, or trigger attributes that are not replaced and restored as stated, fail. | `audit:HoverCard/accessibility` | | ||
| | FR4–FR6, AR2 | `HoverCard.test.tsx` hover, Escape, refocus, and touch tests; `useTouchTrigger.test.ts` and `touchTriggerTargets.test.tsx` disabled-control cases; tap-destination cases an evidence gap until built | Hover, focus, tap, Escape from trigger and content; a trigger inside a link or a clickable card; a disabled control inside a clickable row | A card that cannot be reached or dismissed, or that opens on a tap that already acts, fails. | `audit:HoverCard/behavior` | | ||
| | FR7 | `HoverCard.test.tsx` isEnabled, isDefaultOpen, and onOpenChange tests; `layerDismissalFamilies.test.tsx` controlled HoverCard case | Disabled, default open | Wrong state reporting fails. | `audit:HoverCard/behavior` | | ||
| | FR9, FR10, AR3 | `usePressPin.test.tsx` HoverCard suites (click, Enter, Space, and tap pin; second press, press outside, and focus leaving close; pointer leave and presses on the card keep the pin; labelled and unlabelled announcements; a non-button trigger) and stop-at-trigger cases; `layerDismissalFamilies.test.tsx` pinned HoverCard over a Dialog, uncontrolled and controlled, closed by Escape | Click, Enter, Space, and tap pin; second press, press outside, focus leaving, and Escape close; pointer leave and presses on the card keep the pin; labelled and unlabelled; non-button trigger; a toggle trigger inside a ClickableCard, an Item row, and a `<label>` | A press that does not pin or close as stated, a pin lost on pointer leave, a missing or stale `aria-expanded` or `aria-controls`, a second announcement, a non-button trigger without the warning or its tap fallback, or a pinning press that also activates the card, row, or labelled control around the trigger, fails. | `audit:HoverCard/behavior` | |
There was a problem hiding this comment.
The "stop-at-trigger cases" in usePressPin.test.tsx render Tooltip only; this row's ClickableCard, Item row and <label> states have no HoverCard test. They pass today, so three HoverCard cases would back the claim.
5015adf to
c6b017e
Compare
There was a problem hiding this comment.
Not ready yet: two engineering-owner decisions and four fixes remain. An engineering owner needs to approve or reject the sentence this pull request adds to component:Tooltip FR9 (a plain onClick element around an anchorRef or useTooltip trigger receives the pinning press, where current FR9 says the press never reaches a row or container around the trigger), and to decide whether @astryxdesign/core should publish HoverCardPressTrigger and TooltipPressTrigger, which no current record names; any engineering owner, the author included, can record approval by commenting /approve-spec <full head SHA>.
- Land #9232 and #9361 first and rebase, so this pull request holds only the HoverCard change instead of 2,710 authored lines.
- Both changesets say the press stops at the trigger for
useHoverCardanduseTooltiptoo, but a plainonClickrow around a bare hook trigger still activates; scope that sentence to the components. - A controlled labelled HoverCard announces its label as soon as a press asks it to open, even when the owner keeps it closed; announce only once it pins, and test the declined case.
- Add HoverCard stop cases inside a ClickableCard, an Item row and a
<label>, which its verification row now claims.
[Automated review]
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [feat] HoverCard (and `useHoverCard`) take `pressTrigger` (type `HoverCardPressTrigger`): `none` (the default, unchanged) or `toggle`. With `toggle` on a button trigger, a click, a tap, Enter, or Space pins the card open and the same press closes it, while hover and focus still preview it. A pinned card stays until Escape, a second press, a press outside, or focus leaving; a press on its own content keeps it, and it takes Escape before the layer beneath it. The press stops at its trigger, so a clickable row, card, or label around it does nothing, and the trigger's own handlers still run. The trigger reports `aria-expanded` and `aria-controls`, and the card's `label` (else its text) is announced once when it pins, inside a modal too (`component:HoverCard` FR9 and FR10). On a trigger that is not a button, a labelled card keeps its own popup state and tap-only opening; beside `pressTrigger="toggle"`, `touchTrigger` is ignored. |
There was a problem hiding this comment.
"The press stops at its trigger, so a clickable row, card, or label around it does nothing" holds for the HoverCard component. With the bare useHoverCard hook a plain onClick row still receives the press (as useHoverCard.doc.mjs says). Suggest scoping this sentence to the component and saying what a hook caller does.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [feat] Tooltip (and `useTooltip`) take `pressTrigger` (type `TooltipPressTrigger`): `none` (the default, unchanged) or `toggle`. With `toggle` on a button trigger, a click, a tap, Enter, or Space pins the tooltip open and the same press closes it, while hover and focus still preview it. A pinned tooltip stays until Escape, a second press, a press outside, or focus leaving, and it takes Escape before the layer beneath it. The press stops at its trigger, so a clickable row, card, or label around it does nothing, and the trigger's own handlers still run. With `anchorRef`, Tooltip renders nothing around the trigger to stop it: the anchor's own `onClick` runs, Astryx clickable rows, cards, and containers ignore the press, and a plain `onClick` element around the anchor receives it unless the anchor's `onClick` stops it. The trigger reports `aria-expanded` and `aria-controls`, and the tooltip's text is announced once when it pins, inside a modal too (`component:Tooltip` FR9 and FR10). A trigger that is not a button gets a development warning and keeps tap-only opening; beside `pressTrigger="toggle"`, `touchTrigger` is ignored. |
There was a problem hiding this comment.
Same for useTooltip: a plain onClick row around a bare hook trigger still gets the pinning press; only the Tooltip component stops it at a child trigger.
| if (current.isOpen !== undefined) { | ||
| if (!current.isOpen) { | ||
| armOutsideDismiss(); | ||
| announceName(); |
There was a problem hiding this comment.
For a controlled layer this announces the label before the owner answers onOpenChange(true). If the owner keeps isOpen={false}, a screen-reader user hears the card's name while nothing opens and the trigger says aria-expanded="false". FR10 announces it "when the card pins"; consider announcing once the controlled card shows pinned, with a test where the owner declines.
| | FR6 | Escape closes a visible tooltip; Escape during text composition is ignored. Escape routing follows `family:overlay-dismissal`: a visible topmost tooltip in the page handles that Escape, so a layer underneath stays open for that press. Implementation gap: a tooltip rendered into another document, such as an iframe or a Picture-in-Picture window, with no layer beneath it is never closed by Escape (Current-state impact). `spec:AST-003` FR4, accepted and not yet implemented, makes an unpinned tooltip passive and gives a pinned one Escape first (Current-state impact). Outside `pressTrigger="toggle"`, pressing an uncontrolled tooltip's trigger closes it; a press that focuses a text-entry trigger reopens it through FR4. | WCAG 1.4.13; tests | | ||
| | FR7 | `isOpen` forces the tooltip shown or hidden, and `isOpen={true}` suppresses hover and focus hiding; a controlled tooltip answers Escape by calling `onOpenChange(false)` without hiding, and is not closed by pressing the trigger. `isDefaultOpen` opens it on mount, still dismissible. Implementation gap: with `isOpen={false}`, any focus FR4 opens on, keyboard focus or a click into a text-field trigger, still opens the tooltip and reports `onOpenChange(true)`, and Escape then only reports `onOpenChange(false)`, so it stays until focus or the pointer leaves the trigger or the tooltip, or the caller re-renders with a new `onOpenChange` (Current-state impact). `isEnabled={false}` disables triggers and drops a pending open. | Current source and tests | | ||
| | FR8 | `onOpenChange` reports each show and hide. `hasHoverIndication` (`auto`: a single string or number child) adds a hover cue to the inline trigger. | Current source and tests | | ||
| | FR9 | With `pressTrigger="toggle"` and a trigger whose role is `button` (a `<button>` or `role="button"`), a click, a completed tap, Enter, or Space on the trigger pins the tooltip open, and the same press on a pinned tooltip closes it. Hover and keyboard focus still preview it per FR3 and FR4; on touch no preview opens and a tap pins it, while a touch that becomes a scroll pins nothing. A pinned tooltip stays open when the pointer leaves the trigger and the surface; Escape (FR6), a second press, a press outside the trigger and the surface, or focus moving outside them closes it. In a controlled tooltip a press reports the toggled value through `onOpenChange` and does not change the state itself (FR7). A press that pins or closes the layer stops at its trigger: it does not reach a clickable row, card, or container around it, or the control a label names. With `anchorRef`, or `useTooltip` with a caller's trigger, the caller's own handlers still receive the press: the anchor's `onClick` runs, and a plain `onClick` element around the anchor receives it unless the anchor's `onClick` stops it; Astryx clickable rows, cards, and containers ignore it. A trigger whose role is not `button` gets a development warning and keeps tap-only opening: a tap opens the tooltip as `touchTrigger="tap"` does, and no press pins it. A trigger whose tooltip repeats its own visible text, such as a truncated Text that is its own tab stop, may take `pressTrigger="toggle"` without being a button: a press pins it as on a button trigger, and it gets no development warning, no `aria-expanded` or `aria-controls`, and no announcement, since its text is already its content. Implementation gap: no component reaches the own-text clause yet (Current-state impact). | DEC-1; WCAG 1.4.13, 2.1.1 | |
There was a problem hiding this comment.
The added sentence ("With anchorRef, or useTooltip with a caller's trigger, the caller's own handlers still receive the press ...") relaxes current FR9, which says the press "does not reach a clickable row, card, or container around it". That is a requirement change, so it needs an engineering owner's approval (/approve-spec <full head SHA>), or the anchored Tooltip has to stop the press as FR9 says today.
| | FR3, AR1 | `HoverCard.test.tsx` role and trigger-attribute tests | Labelled and unlabelled; supported and unsupported roles | Wrong role, or trigger attributes that are not replaced and restored as stated, fail. | `audit:HoverCard/accessibility` | | ||
| | FR4–FR6, AR2 | `HoverCard.test.tsx` hover, Escape, refocus, and touch tests; `useTouchTrigger.test.ts` and `touchTriggerTargets.test.tsx` disabled-control cases; tap-destination cases an evidence gap until built | Hover, focus, tap, Escape from trigger and content; a trigger inside a link or a clickable card; a disabled control inside a clickable row | A card that cannot be reached or dismissed, or that opens on a tap that already acts, fails. | `audit:HoverCard/behavior` | | ||
| | FR7 | `HoverCard.test.tsx` isEnabled, isDefaultOpen, and onOpenChange tests; `layerDismissalFamilies.test.tsx` controlled HoverCard case | Disabled, default open | Wrong state reporting fails. | `audit:HoverCard/behavior` | | ||
| | FR9, FR10, AR3 | `usePressPin.test.tsx` HoverCard suites (click, Enter, Space, and tap pin; second press, press outside, and focus leaving close; pointer leave and presses on the card keep the pin; labelled and unlabelled announcements; a non-button trigger) and stop-at-trigger cases; `layerDismissalFamilies.test.tsx` pinned HoverCard over a Dialog, uncontrolled and controlled, closed by Escape | Click, Enter, Space, and tap pin; second press, press outside, focus leaving, and Escape close; pointer leave and presses on the card keep the pin; labelled and unlabelled; non-button trigger; a toggle trigger inside a ClickableCard, an Item row, and a `<label>` | A press that does not pin or close as stated, a pin lost on pointer leave, a missing or stale `aria-expanded` or `aria-controls`, a second announcement, a non-button trigger without the warning or its tap fallback, or a pinning press that also activates the card, row, or labelled control around the trigger, fails. | `audit:HoverCard/behavior` | |
There was a problem hiding this comment.
The "stop-at-trigger cases" in usePressPin.test.tsx render Tooltip only; this row's ClickableCard, Item row and <label> states have no HoverCard test. They pass today, so three HoverCard cases would back the claim.
c6b017e to
26c8977
Compare
There was a problem hiding this comment.
Not ready yet: two engineering-owner decisions and four fixes remain. An engineering owner needs to approve or reject the sentence this pull request adds to component:Tooltip FR9 (a plain onClick element around an anchorRef or useTooltip trigger receives the pinning press, where current FR9 says the press never reaches a row or container around the trigger), and to decide whether @astryxdesign/core should publish HoverCardTriggerBehavior and TooltipTriggerBehavior, which no current record names; any engineering owner, the author included, can record approval by commenting /approve-spec <full head SHA>.
- Land #9232 and #9361 first and rebase on
main(this branch now conflicts there), so this pull request holds only the HoverCard change instead of 3,049 authored lines. - A controlled labelled HoverCard announces its label as soon as a press asks it to open, even when the owner keeps it closed; announce only once it pins, and test the declined case.
- The HoverCard changeset says the press stops at the trigger for
useHoverCardtoo, but a plainonClickrow around a bare hook trigger still activates; scope it to the component, and update the API table in the description to'adaptive' | 'hover' | 'toggle'with the Tooltip rows. - Add HoverCard stop cases inside a ClickableCard, an Item row and a
<label>, which its verification row now cites as covered.
[Automated review]
| if (current.isOpen !== undefined) { | ||
| if (!current.isOpen) { | ||
| armOutsideDismiss(); | ||
| announceName(); |
There was a problem hiding this comment.
For a controlled layer this announces the label before the owner answers onOpenChange(true). If the owner keeps isOpen={false}, a screen-reader user hears the label while nothing opens and the trigger says aria-expanded="false". HoverCard FR10 announces "when the card pins"; consider announcing a controlled card's label once it shows pinned, and adding a declined-owner case.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [feat] HoverCard (and `useHoverCard`) take `triggerBehavior` (type `HoverCardTriggerBehavior`): `adaptive`, the default and the released behavior, where hover and focus preview the card and a tap opens it unless the trigger performs an action of its own; `hover`, where hover and focus preview it and touch never opens it; or `toggle`, where hover and focus still preview it and a click, a tap, Enter, or Space on a button trigger pins it open, and the same press closes it. A pinned card stays until Escape, a second press, a press outside, or focus leaving; a press on its own content keeps it, and it takes Escape before the layer beneath it. The press stops at its trigger, so a clickable row, card, or label around it does nothing, and the trigger's own handlers still run. The trigger reports `aria-expanded` and `aria-controls`, and the card's `label` (else its text) is announced once when it pins, inside a modal too (`component:HoverCard` FR9 and FR10). On a trigger that is not a button, a labelled card keeps its own popup state and tap-only opening; `touchTrigger` decides taps only under `adaptive`; `hover` and `toggle` ignore it. |
There was a problem hiding this comment.
"The press stops at its trigger, so a clickable row, card, or label around it does nothing" holds for the HoverCard component. With the bare useHoverCard hook, a plain onClick row around the trigger still activates (as useHoverCard.doc.mjs says). The Tooltip changeset scopes this; the same wording would fit here.
| | FR3, AR1 | `HoverCard.test.tsx` role and trigger-attribute tests | Labelled and unlabelled; supported and unsupported roles | Wrong role, or trigger attributes that are not replaced and restored as stated, fail. | `audit:HoverCard/accessibility` | | ||
| | FR4–FR6, AR2 | `HoverCard.test.tsx` hover, Escape, refocus, and touch tests; `useTouchTrigger.test.ts` and `touchTriggerTargets.test.tsx` disabled-control cases; tap-destination cases an evidence gap until built | Hover, focus, tap, Escape from trigger and content; a trigger inside a link or a clickable card; a disabled control inside a clickable row | A card that cannot be reached or dismissed, or that opens on a tap that already acts, fails. | `audit:HoverCard/behavior` | | ||
| | FR7 | `HoverCard.test.tsx` isEnabled, isDefaultOpen, and onOpenChange tests; `layerDismissalFamilies.test.tsx` controlled HoverCard case | Disabled, default open | Wrong state reporting fails. | `audit:HoverCard/behavior` | | ||
| | FR9, FR10, AR3 | `usePressPin.test.tsx` HoverCard suites (click, Enter, Space, and tap pin; second press, press outside, and focus leaving close; pointer leave and presses on the card keep the pin; labelled and unlabelled announcements; a non-button trigger) and stop-at-trigger cases; `layerDismissalFamilies.test.tsx` pinned HoverCard over a Dialog, uncontrolled and controlled, closed by Escape | Click, Enter, Space, and tap pin; second press, press outside, focus leaving, and Escape close; pointer leave and presses on the card keep the pin; labelled and unlabelled; non-button trigger; a toggle trigger inside a ClickableCard, an Item row, and a `<label>` | A press that does not pin or close as stated, a pin lost on pointer leave, a missing or stale `aria-expanded` or `aria-controls`, a second announcement, a non-button trigger without the warning or its tap fallback, or a pinning press that also activates the card, row, or labelled control around the trigger, fails. | `audit:HoverCard/behavior` | |
There was a problem hiding this comment.
The "stop-at-trigger cases" in usePressPin.test.tsx render Tooltip only; this row's ClickableCard, Item row and <label> states have no HoverCard test. Three HoverCard cases beside the existing plain-row one would back the row.
| | FR6 | Escape closes a visible tooltip; Escape during text composition is ignored. Escape routing follows `family:overlay-dismissal`: a visible topmost tooltip in the page handles that Escape, so a layer underneath stays open for that press. Implementation gap: a tooltip rendered into another document, such as an iframe or a Picture-in-Picture window, with no layer beneath it is never closed by Escape (Current-state impact). `spec:AST-003` FR4, accepted and not yet implemented, makes an unpinned tooltip passive and gives a pinned one Escape first (Current-state impact). Outside `triggerBehavior="toggle"`, pressing an uncontrolled tooltip's trigger closes it; a press that focuses a text-entry trigger reopens it through FR4. | WCAG 1.4.13; tests | | ||
| | FR7 | `isOpen` forces the tooltip shown or hidden, and `isOpen={true}` suppresses hover and focus hiding; a controlled tooltip answers Escape by calling `onOpenChange(false)` without hiding, and is not closed by pressing the trigger. `isDefaultOpen` opens it on mount, still dismissible. Implementation gap: with `isOpen={false}`, any focus FR4 opens on, keyboard focus or a click into a text-field trigger, still opens the tooltip and reports `onOpenChange(true)`, and Escape then only reports `onOpenChange(false)`, so it stays until focus or the pointer leaves the trigger or the tooltip, or the caller re-renders with a new `onOpenChange` (Current-state impact). `isEnabled={false}` disables triggers and drops a pending open. | Current source and tests | | ||
| | FR8 | `onOpenChange` reports each show and hide. `hasHoverIndication` (`auto`: a single string or number child) adds a hover cue to the inline trigger. | Current source and tests | | ||
| | FR9 | With `triggerBehavior="toggle"` and a trigger whose role is `button` (a `<button>` or `role="button"`), a click, a completed tap, Enter, or Space on the trigger pins the tooltip open, and the same press on a pinned tooltip closes it. Hover and keyboard focus still preview it per FR3 and FR4; on touch no preview opens and a tap pins it, while a touch that becomes a scroll pins nothing. A pinned tooltip stays open when the pointer leaves the trigger and the surface; Escape (FR6), a second press, a press outside the trigger and the surface, or focus moving outside them closes it. In a controlled tooltip a press reports the toggled value through `onOpenChange` and does not change the state itself (FR7). A press that pins or closes the layer stops at its trigger: it does not reach a clickable row, card, or container around it, or the control a label names. With `anchorRef`, or `useTooltip` with a caller's trigger, the caller's own handlers still receive the press: the anchor's `onClick` runs, and a plain `onClick` element around the anchor receives it unless the anchor's `onClick` stops it; Astryx clickable rows, cards, and containers ignore it. A trigger whose role is not `button` gets a development warning and keeps tap-only opening: every completed tap opens the tooltip, and no press pins it. A trigger whose tooltip repeats its own visible text, such as a truncated Text that is its own tab stop, may take `triggerBehavior="toggle"` without being a button: a press pins it as on a button trigger, and it gets no development warning, no `aria-expanded` or `aria-controls`, and no announcement, since its text is already its content. Implementation gap: no component reaches the own-text clause yet (Current-state impact). | DEC-1; WCAG 1.4.13, 2.1.1 | |
There was a problem hiding this comment.
The added sentence ("With anchorRef, or useTooltip with a caller's trigger, the caller's own handlers still receive the press ...") relaxes current FR9, which says a pinning press does not reach a clickable row, card, or container around the trigger. That is a requirement change, so it needs an engineering owner's /approve-spec on this head, or the anchored Tooltip stops the press as FR9 says today.
26c8977 to
c2f647a
Compare
There was a problem hiding this comment.
Not ready yet: three engineering-owner decisions and three fixes remain. An engineering owner needs to approve or reject the sentences this pull request adds to component:Tooltip FR9 and component:HoverCard FR9 (a plain onClick element around an anchorRef, useTooltip or useHoverCard trigger receives the pinning press, where current FR9 says the press never reaches a row or container around the trigger), and to decide whether @astryxdesign/core should publish HoverCardTriggerBehavior and TooltipTriggerBehavior, which no current record names; any engineering owner, the author included, can record approval by commenting /approve-spec <full head SHA>.
- Land #9232, #9406 and #9361 first and rebase, so this pull request holds only the HoverCard change instead of 3,197 authored lines.
- A controlled labelled HoverCard announces its label as soon as a press asks it to open, even when the owner keeps it closed; announce only once it pins, and test the declined case.
- Add HoverCard stop cases inside a ClickableCard, an Item row and a
<label>, which its verification row cites, and update the description's API table to'adaptive' | 'hover' | 'toggle', default'adaptive', with the Tooltip rows.
[Automated review]
| if (current.isOpen !== undefined) { | ||
| if (!current.isOpen) { | ||
| armOutsideDismiss(); | ||
| announceName(); |
There was a problem hiding this comment.
For a controlled layer this says the label before the owner answers onOpenChange(true). If the owner keeps isOpen={false}, a screen-reader user hears the label while nothing opens and the trigger says aria-expanded="false". Announce a controlled card's label only once it shows pinned, and add a declined-owner case.
| | FR6 | Escape closes a visible card through the shared dismissal stack when it is the topmost layer in the page, so a layer underneath stays open. Implementation gap: a card rendered into another document, such as an iframe or a Picture-in-Picture window, with no layer beneath it is never closed by Escape (Current-state impact). When focus was inside the card, it returns to the trigger, and that refocus does not reopen the card. | WCAG 1.4.13; tests | | ||
| | FR7 | `isOpen` forces the card shown or hidden, and `isOpen={true}` suppresses hover and focus hiding; a controlled card answers Escape by calling `onOpenChange(false)` without hiding, and setting `isOpen={false}` while focus is inside the card returns focus to the trigger. `isDefaultOpen` opens it on mount, still dismissible. Implementation gap: with `isOpen={false}`, focus on the trigger still opens the card, and Escape then only reports `onOpenChange(false)` (Current-state impact). `isEnabled={false}` disables the triggers. `onOpenChange` reports each show and hide. | Current source and tests | | ||
| | FR8 | Content renders only while open; server markup and the first client render match, including a default-open card. `hasHoverIndication` (`auto`: a single string or number child) adds a hover cue to the inline trigger. | Current source and tests | | ||
| | FR9 | With `triggerBehavior="toggle"` and a trigger whose role is `button` (a `<button>` or `role="button"`), a click, a completed tap, Enter, or Space on the trigger pins the card open, and the same press on a pinned card closes it. Hover and focus still preview it per FR4; on touch no preview opens and a tap pins it, while a touch that becomes a scroll pins nothing. A pinned card stays open when the pointer leaves the trigger and the card, and a press on its own content keeps it pinned; Escape (FR6), a second press on the trigger, a press outside the trigger and the card, or focus moving outside them closes it. In a controlled card a press reports the toggled value through `onOpenChange` and does not change the state itself (FR7). A press that pins or closes the layer stops at its trigger: it does not reach a clickable row, card, or container around it, or the control a label names. With `useHoverCard` and a caller's trigger, the caller's own handlers still receive the press: the trigger's `onClick` runs, and a plain `onClick` element around the trigger receives it unless the trigger's `onClick` stops it; Astryx clickable rows, cards, and containers ignore it. A trigger whose role is not `button` gets a development warning and keeps tap-only opening: every completed tap opens the card, and no press pins it. | DEC-1; WCAG 1.4.13, 2.1.1 | |
There was a problem hiding this comment.
The added useHoverCard sentence relaxes current FR9 ("does not reach a clickable row, card, or container around it"), which the Public contract applies to the hook too. That is a requirement change, so it needs an engineering owner's approval (/approve-spec <full head SHA>), or the hook should stop the press as FR9 says today.
| | FR6 | Escape closes a visible tooltip; Escape during text composition is ignored. Escape routing follows `family:overlay-dismissal`: a visible topmost tooltip in the page handles that Escape, so a layer underneath stays open for that press. Implementation gap: a tooltip rendered into another document, such as an iframe or a Picture-in-Picture window, with no layer beneath it is never closed by Escape (Current-state impact). `spec:AST-003` FR4, accepted and not yet implemented, makes an unpinned tooltip passive and gives a pinned one Escape first (Current-state impact). Outside `triggerBehavior="toggle"`, pressing an uncontrolled tooltip's trigger closes it; a press that focuses a text-entry trigger reopens it through FR4. | WCAG 1.4.13; tests | | ||
| | FR7 | `isOpen` forces the tooltip shown or hidden, and `isOpen={true}` suppresses hover and focus hiding; a controlled tooltip answers Escape by calling `onOpenChange(false)` without hiding, and is not closed by pressing the trigger. `isDefaultOpen` opens it on mount, still dismissible. Implementation gap: with `isOpen={false}`, any focus FR4 opens on, keyboard focus or a click into a text-field trigger, still opens the tooltip and reports `onOpenChange(true)`, and Escape then only reports `onOpenChange(false)`, so it stays until focus or the pointer leaves the trigger or the tooltip, or the caller re-renders with a new `onOpenChange` (Current-state impact). `isEnabled={false}` disables triggers and drops a pending open. | Current source and tests | | ||
| | FR8 | `onOpenChange` reports each show and hide. `hasHoverIndication` (`auto`: a single string or number child) adds a hover cue to the inline trigger. | Current source and tests | | ||
| | FR9 | With `triggerBehavior="toggle"` and a trigger whose role is `button` (a `<button>` or `role="button"`), a click, a completed tap, Enter, or Space on the trigger pins the tooltip open, and the same press on a pinned tooltip closes it. Hover and keyboard focus still preview it per FR3 and FR4; on touch no preview opens and a tap pins it, while a touch that becomes a scroll pins nothing. A pinned tooltip stays open when the pointer leaves the trigger and the surface; Escape (FR6), a second press, a press outside the trigger and the surface, or focus moving outside them closes it. In a controlled tooltip a press reports the toggled value through `onOpenChange` and does not change the state itself (FR7). A press that pins or closes the layer stops at its trigger: it does not reach a clickable row, card, or container around it, or the control a label names. With `anchorRef`, or `useTooltip` with a caller's trigger, the caller's own handlers still receive the press: the anchor's `onClick` runs, and a plain `onClick` element around the anchor receives it unless the anchor's `onClick` stops it; Astryx clickable rows, cards, and containers ignore it. A trigger whose role is not `button` gets a development warning and keeps tap-only opening: every completed tap opens the tooltip, and no press pins it. A trigger whose tooltip repeats its own visible text, such as a truncated Text that is its own tab stop, may take `triggerBehavior="toggle"` without being a button: a press pins it as on a button trigger, and it gets no development warning, no `aria-expanded` or `aria-controls`, and no announcement, since its text is already its content. Implementation gap: no component reaches the own-text clause yet (Current-state impact). | DEC-1; WCAG 1.4.13, 2.1.1 | |
There was a problem hiding this comment.
The added sentence ("With anchorRef, or useTooltip with a caller's trigger, the caller's own handlers still receive the press ...") relaxes current FR9, which says a pinning press does not reach a row or container around the trigger. It needs an engineering owner's approval (/approve-spec <full head SHA>), or the anchored and hook paths should stop the press.
| | FR3, AR1 | `HoverCard.test.tsx` role and trigger-attribute tests | Labelled and unlabelled; supported and unsupported roles | Wrong role, or trigger attributes that are not replaced and restored as stated, fail. | `audit:HoverCard/accessibility` | | ||
| | FR4–FR6, AR2 | `HoverCard.test.tsx` hover, Escape, refocus, and touch tests; `useTouchTrigger.test.ts` and `touchTriggerTargets.test.tsx` disabled-control cases; tap-destination cases an evidence gap until built | Hover, focus, tap, Escape from trigger and content; a trigger inside a link or a clickable card; a disabled control inside a clickable row | A card that cannot be reached or dismissed, or that opens on a tap that already acts, fails. | `audit:HoverCard/behavior` | | ||
| | FR7 | `HoverCard.test.tsx` isEnabled, isDefaultOpen, and onOpenChange tests; `layerDismissalFamilies.test.tsx` controlled HoverCard case | Disabled, default open | Wrong state reporting fails. | `audit:HoverCard/behavior` | | ||
| | FR9, FR10, AR3 | `usePressPin.test.tsx` HoverCard suites (click, Enter, Space, and tap pin; second press, press outside, and focus leaving close; pointer leave and presses on the card keep the pin; labelled and unlabelled announcements; a non-button trigger) and stop-at-trigger cases; `layerDismissalFamilies.test.tsx` pinned HoverCard over a Dialog, uncontrolled and controlled, closed by Escape | Click, Enter, Space, and tap pin; second press, press outside, focus leaving, and Escape close; pointer leave and presses on the card keep the pin; labelled and unlabelled; non-button trigger; a toggle trigger inside a ClickableCard, an Item row, and a `<label>` | A press that does not pin or close as stated, a pin lost on pointer leave, a missing or stale `aria-expanded` or `aria-controls`, a second announcement, a non-button trigger without the warning or its tap fallback, or a pinning press that also activates the card, row, or labelled control around the trigger, fails. | `audit:HoverCard/behavior` | |
There was a problem hiding this comment.
The "stop-at-trigger cases" in usePressPin.test.tsx render Tooltip; this row's ClickableCard, Item row and <label> states have no HoverCard test. Three HoverCard cases beside the existing plain-row one would close the gap.
c2f647a to
14035ef
Compare
There was a problem hiding this comment.
Not ready yet: three engineering-owner decisions and three fixes remain. An engineering owner needs to approve or reject the sentences this pull request adds to component:HoverCard FR9 and component:Tooltip FR9 (a plain onClick element around a useHoverCard, useTooltip or anchorRef trigger still receives the pinning press, where current FR9 says the press stops at the trigger), and decide whether @astryxdesign/core should export HoverCardTriggerBehavior and TooltipTriggerBehavior; any engineering owner, the author included, records an approval by commenting /approve-spec <full head SHA>. Whatever they decide, please:
- Land #9232, #9406 and #9361 first and rebase, so this diff is the HoverCard change alone.
- Announce a controlled labelled card only once it pins, since today its label is said even when the owner keeps
isOpen={false}. - Add HoverCard tests for a toggle trigger inside a ClickableCard, an Item row and a
<label>, which the verification row requires, and correct the API table in the description.
[Automated review]
| if (current.isOpen !== undefined) { | ||
| if (!current.isOpen) { | ||
| armOutsideDismiss(); | ||
| announceName(); | ||
| } else { | ||
| clearTapOpen(); | ||
| } | ||
| current.report(!current.isOpen); |
There was a problem hiding this comment.
For a controlled layer this says the label before the owner answers onOpenChange(true). If the owner keeps isOpen={false}, a screen-reader user hears "Ada's profile" while nothing opens and the trigger says aria-expanded="false". Announce a controlled labelled card only once it shows pinned (isPinShown), and add a declined-owner case beside the accepting one.
| | FR6 | Escape closes a visible card through the shared dismissal stack when it is the topmost layer in the page, so a layer underneath stays open. Implementation gap: a card rendered into another document, such as an iframe or a Picture-in-Picture window, with no layer beneath it is never closed by Escape (Current-state impact). When focus was inside the card, it returns to the trigger, and that refocus does not reopen the card. | WCAG 1.4.13; tests | | ||
| | FR7 | `isOpen` forces the card shown or hidden, and `isOpen={true}` suppresses hover and focus hiding; a controlled card answers Escape by calling `onOpenChange(false)` without hiding, and setting `isOpen={false}` while focus is inside the card returns focus to the trigger. `isDefaultOpen` opens it on mount, still dismissible. Implementation gap: with `isOpen={false}`, focus on the trigger still opens the card, and Escape then only reports `onOpenChange(false)` (Current-state impact). `isEnabled={false}` disables the triggers. `onOpenChange` reports each show and hide. | Current source and tests | | ||
| | FR8 | Content renders only while open; server markup and the first client render match, including a default-open card. `hasHoverIndication` (`auto`: a single string or number child) adds a hover cue to the inline trigger. | Current source and tests | | ||
| | FR9 | With `triggerBehavior="toggle"` and a trigger whose role is `button` (a `<button>` or `role="button"`), a click, a completed tap, Enter, or Space on the trigger pins the card open, and the same press on a pinned card closes it. Hover and focus still preview it per FR4; on touch no preview opens and a tap pins it, while a touch that becomes a scroll pins nothing. A pinned card stays open when the pointer leaves the trigger and the card, and a press on its own content keeps it pinned; Escape (FR6), a second press on the trigger, a press outside the trigger and the card, or focus moving outside them closes it. In a controlled card a press reports the toggled value through `onOpenChange` and does not change the state itself (FR7). A press that pins or closes the layer stops at its trigger: it does not reach a clickable row, card, or container around it, or the control a label names. With `useHoverCard` and a caller's trigger, the caller's own handlers still receive the press: the trigger's `onClick` runs, and a plain `onClick` element around the trigger receives it unless the trigger's `onClick` stops it; Astryx clickable rows, cards, and containers ignore it. A trigger whose role is not `button` gets a development warning and keeps tap-only opening: every completed tap opens the card, and no press pins it. | DEC-1; WCAG 1.4.13, 2.1.1 | |
There was a problem hiding this comment.
The added useHoverCard sentence relaxes current FR9 ("does not reach a clickable row, card, or container around it"), which the Public contract applies to the hook too. It needs an engineering owner's /approve-spec, or useHoverCard should stop the press as FR9 says today.
| | FR3, AR1 | `HoverCard.test.tsx` role and trigger-attribute tests | Labelled and unlabelled; supported and unsupported roles | Wrong role, or trigger attributes that are not replaced and restored as stated, fail. | `audit:HoverCard/accessibility` | | ||
| | FR4–FR6, AR2 | `HoverCard.test.tsx` hover, Escape, refocus, and touch tests; `useTouchTrigger.test.ts` and `touchTriggerTargets.test.tsx` disabled-control cases; tap-destination cases an evidence gap until built | Hover, focus, tap, Escape from trigger and content; a trigger inside a link or a clickable card; a disabled control inside a clickable row | A card that cannot be reached or dismissed, or that opens on a tap that already acts, fails. | `audit:HoverCard/behavior` | | ||
| | FR7 | `HoverCard.test.tsx` isEnabled, isDefaultOpen, and onOpenChange tests; `layerDismissalFamilies.test.tsx` controlled HoverCard case | Disabled, default open | Wrong state reporting fails. | `audit:HoverCard/behavior` | | ||
| | FR9, FR10, AR3 | `usePressPin.test.tsx` HoverCard suites (click, Enter, Space, and tap pin; second press, press outside, and focus leaving close; pointer leave and presses on the card keep the pin; labelled and unlabelled announcements; a non-button trigger) and stop-at-trigger cases; `layerDismissalFamilies.test.tsx` pinned HoverCard over a Dialog, uncontrolled and controlled, closed by Escape | Click, Enter, Space, and tap pin; second press, press outside, focus leaving, and Escape close; pointer leave and presses on the card keep the pin; labelled and unlabelled; non-button trigger; a toggle trigger inside a ClickableCard, an Item row, and a `<label>` | A press that does not pin or close as stated, a pin lost on pointer leave, a missing or stale `aria-expanded` or `aria-controls`, a second announcement, a non-button trigger without the warning or its tap fallback, or a pinning press that also activates the card, row, or labelled control around the trigger, fails. | `audit:HoverCard/behavior` | |
There was a problem hiding this comment.
The "stop-at-trigger cases" in usePressPin.test.tsx render Tooltip; this row's ClickableCard, Item row and <label> states have no HoverCard component test (the component has only a plain onClick row case). Three HoverCard cases would close it; the behaviour holds when tried.
|
/approve-spec 14035ef |
…out toggle state `component:Tooltip` FR9's own-text clause, on the shared press pin (`Layer/usePressPin.ts`): - usePressPin's internal `repeatsTriggerText` option, passed through useTooltipInternal (useTooltip with Core's internal options), pins a trigger whose tooltip repeats its own visible text, such as a truncated Text that is its own tab stop, without a button trigger: no development warning, no aria-expanded or aria-controls, and no announcement. The option joins the settle key and the re-wire Effect, so turning it on after mount wires the trigger. - Astryx clickable containers and rows ignore a press-pin click: the mark lives in `Layer/pressPinClick.ts`, which useClickableContainer, Item rows, TreeList rows, and the Table row-expansion and tree-data row clicks read. So a trigger that is not a nested button, an own-text trigger or an anchored `role="button"` element, doesn't activate the card or row around it when no component wrapper stops the press. - No component passes the option yet; the record keeps that implementation gap. - With the gap closed, Tooltip's FR9 gap note, its current-state item, and the Item-row exception in the changeset, docs, and JSDoc go.
14035ef to
8fa3613
Compare
|
Updated in 8fa3613, restacked on #9361's ed6c6cf (on main, which now carries #9232 and #9406).
This head needs a spec owner's |
There was a problem hiding this comment.
Not ready yet: one engineering-owner decision and one fix remain.
The sentence this pull request adds to component:HoverCard FR9 (with useHoverCard and a caller's trigger, a plain onClick element around the trigger receives the pinning press) relaxes the current FR9 stop clause, and an engineering owner approved it only at an earlier head. Any engineering owner, the author included, records the decision for this head by commenting /approve-spec <full head SHA>, or rejects it so useHoverCard stops the press as FR9 says today. Whatever they decide, please fix:
- In a controlled labelled card, a press the owner declines leaves the pending-announcement flag set (
packages/core/src/Layer/usePressPin.ts:279), so the next time the owner opens the card the label is announced as if that press had pinned it; announce the label on the same shown-pinned transition the unlabelled text uses, and add a declined-then-opened case.
[Automated review]
| if (!current.isOpen) { | ||
| armOutsideDismiss(); | ||
| announceName(); | ||
| nameOnPinRef.current = true; |
There was a problem hiding this comment.
When the owner declines this request and keeps isOpen={false}, nothing clears this flag while the card stays closed. The next time the owner opens the card for any reason, the Effect below says the label and arms the outside dismissal as if this press had pinned it, while an owner-opened card with no earlier press says nothing (and an unlabelled card says its text either way). Suggest announcing the label on the same shown-pinned transition the unlabelled text uses (isPinShown) and dropping the flag, or clearing it when the owner leaves the card closed, plus a declined-then-opened test.
| | FR6 | Escape closes a visible card through the shared dismissal stack when it is the topmost layer in the page, so a layer underneath stays open. Implementation gap: a card rendered into another document, such as an iframe or a Picture-in-Picture window, with no layer beneath it is never closed by Escape (Current-state impact). When focus was inside the card, it returns to the trigger, and that refocus does not reopen the card. | WCAG 1.4.13; tests | | ||
| | FR7 | `isOpen` forces the card shown or hidden, and `isOpen={true}` suppresses hover and focus hiding; a controlled card answers Escape by calling `onOpenChange(false)` without hiding, and setting `isOpen={false}` while focus is inside the card returns focus to the trigger. `isDefaultOpen` opens it on mount, still dismissible. Implementation gap: with `isOpen={false}`, focus on the trigger still opens the card, and Escape then only reports `onOpenChange(false)` (Current-state impact). `isEnabled={false}` disables the triggers. `onOpenChange` reports each show and hide. | Current source and tests | | ||
| | FR8 | Content renders only while open; server markup and the first client render match, including a default-open card. `hasHoverIndication` (`auto`: a single string or number child) adds a hover cue to the inline trigger. | Current source and tests | | ||
| | FR9 | With `triggerBehavior="toggle"` and a trigger whose role is `button` (a `<button>` or `role="button"`), a click, a completed tap, Enter, or Space on the trigger pins the card open, and the same press on a pinned card closes it. Hover and focus still preview it per FR4; on touch no preview opens and a tap pins it, while a touch that becomes a scroll pins nothing. A pinned card stays open when the pointer leaves the trigger and the card, and a press on its own content keeps it pinned; Escape (FR6), a second press on the trigger, a press outside the trigger and the card, or focus moving outside them closes it. In a controlled card a press reports the toggled value through `onOpenChange` and does not change the state itself (FR7). A press that pins or closes the layer stops at its trigger: it does not reach a clickable row, card, or container around it, or the control a label names. With `useHoverCard` and a caller's trigger, the caller's own handlers still receive the press: the trigger's `onClick` runs, and a plain `onClick` element around the trigger receives it unless the trigger's `onClick` stops it; Astryx clickable rows, cards, and containers ignore it. A trigger whose role is not `button` gets a development warning and keeps tap-only opening: every completed tap opens the card, and no press pins it. | DEC-1; WCAG 1.4.13, 2.1.1 | |
There was a problem hiding this comment.
The added sentence ("With useHoverCard and a caller's trigger, the caller's own handlers still receive the press ...") relaxes current FR9 ("does not reach a clickable row, card, or container around it"). It was approved at an earlier head; approval binds to a head, so it needs an engineering owner's /approve-spec <full head SHA> here, or a rejection so useHoverCard stops the press.
| | FR3, AR1 | `HoverCard.test.tsx` role, trigger-attribute, and attribute-restore tests; `HoverCardAudit` frames and the audit axe pass on `HoverCard / Open States` | Labelled and unlabelled; supported and unsupported roles | Wrong role, trigger attributes that are not replaced and restored as stated, or a new axe violation on an open card, fail. | `audit:HoverCard/accessibility` | | ||
| | FR4–FR6, AR2 | `HoverCard.test.tsx` hover, delay and hide-delay timing, trigger-to-card hold, Escape, refocus, and touch tests; `HoverCardAudit` hover-and-keyboard pass in Chromium; `useTouchTrigger.test.ts` and `touchTriggerTargets.test.tsx` disabled-control cases; tap-destination cases an evidence gap until built | Hover, focus, tap, Escape from trigger and content; a trigger inside a link or a clickable card; a disabled control inside a clickable row | A card that cannot be reached or dismissed, that opens before `delay` or closes before `hideDelay`, that closes while the pointer moves from the trigger into it, or that opens on a tap that already acts, fails. | `audit:HoverCard/behavior` | | ||
| | FR7 | `HoverCard.test.tsx` isEnabled, isDefaultOpen, onOpenChange, `isOpen` forcing, and controlled-close focus-return tests; `layerDismissalFamilies.test.tsx` controlled HoverCard case | Disabled, default open, held open, held closed, closed by the caller with focus inside | Wrong state reporting, a hover that hides a card held open or opens one held closed, or focus left inside a card the caller closes, fails. | `audit:HoverCard/behavior` | | ||
| | FR9, FR10, AR3 | `usePressPin.test.tsx` HoverCard suites (click, Enter, Space, and tap pin; second press, press outside, and focus leaving close; pointer leave and presses on the card keep the pin; labelled and unlabelled announcements; a non-button trigger) and stop-at-trigger cases; `layerDismissalFamilies.test.tsx` pinned HoverCard over a Dialog, uncontrolled and controlled, closed by Escape | Click, Enter, Space, and tap pin; second press, press outside, focus leaving, and Escape close; pointer leave and presses on the card keep the pin; labelled and unlabelled; non-button trigger; a toggle trigger inside a ClickableCard, an Item row, and a `<label>` | A press that does not pin or close as stated, a pin lost on pointer leave, a missing or stale `aria-expanded` or `aria-controls`, a second announcement, a non-button trigger without the warning or its tap fallback, or a pinning press that also activates the card, row, or labelled control around the trigger, fails. | `audit:HoverCard/behavior` | |
There was a problem hiding this comment.
Non-blocking: the ClickableCard, Item row and <label> stop cases for the HoverCard component live in HoverCard.test.tsx ("a HoverCard toggle press stops at its trigger"), not in usePressPin.test.tsx. Suggest citing them there.
| if (!ownsToggleState) { | ||
| // The press pin sets it. |
There was a problem hiding this comment.
Non-blocking (comment style): this empty branch, and the one at line 391, can be inverted to if (ownsToggleState) { ... }, letting the comment above ownsToggleState carry the reason.
8fa3613 to
b5931d2
Compare
|
Updated in b5931d2.
This head needs a spec owner's |
There was a problem hiding this comment.
Not ready yet: one engineering-owner decision remains, and nothing else blocks.
The sentence this pull request adds to component:HoverCard FR9 (with useHoverCard and a caller's trigger, a plain onClick element around the trigger still receives the pinning press) relaxes the current FR9 stop clause, and its earlier approval was at a previous head. Any engineering owner, the author included, records the decision for this head by commenting /approve-spec <full head SHA>, or rejects it so useHoverCard stops the press as FR9 says today.
The declined-press announcement fix holds, with its new test. One optional comment suggestion is inline.
[Automated review]
| | FR6 | Escape closes a visible card through the shared dismissal stack when it is the topmost layer in the page, so a layer underneath stays open. Implementation gap: a card rendered into another document, such as an iframe or a Picture-in-Picture window, with no layer beneath it is never closed by Escape (Current-state impact). When focus was inside the card, it returns to the trigger, and that refocus does not reopen the card. | WCAG 1.4.13; tests | | ||
| | FR7 | `isOpen` forces the card shown or hidden, and `isOpen={true}` suppresses hover and focus hiding; a controlled card answers Escape by calling `onOpenChange(false)` without hiding, and setting `isOpen={false}` while focus is inside the card returns focus to the trigger. `isDefaultOpen` opens it on mount, still dismissible. Implementation gap: with `isOpen={false}`, focus on the trigger still opens the card, and Escape then only reports `onOpenChange(false)` (Current-state impact). `isEnabled={false}` disables the triggers. `onOpenChange` reports each show and hide. | Current source and tests | | ||
| | FR8 | Content renders only while open; server markup and the first client render match, including a default-open card. `hasHoverIndication` (`auto`: a single string or number child) adds a hover cue to the inline trigger. | Current source and tests | | ||
| | FR9 | With `triggerBehavior="toggle"` and a trigger whose role is `button` (a `<button>` or `role="button"`), a click, a completed tap, Enter, or Space on the trigger pins the card open, and the same press on a pinned card closes it. Hover and focus still preview it per FR4; on touch no preview opens and a tap pins it, while a touch that becomes a scroll pins nothing. A pinned card stays open when the pointer leaves the trigger and the card, and a press on its own content keeps it pinned; Escape (FR6), a second press on the trigger, a press outside the trigger and the card, or focus moving outside them closes it. In a controlled card a press reports the toggled value through `onOpenChange` and does not change the state itself (FR7). A press that pins or closes the layer stops at its trigger: it does not reach a clickable row, card, or container around it, or the control a label names. With `useHoverCard` and a caller's trigger, the caller's own handlers still receive the press: the trigger's `onClick` runs, and a plain `onClick` element around the trigger receives it unless the trigger's `onClick` stops it; Astryx clickable rows, cards, and containers ignore it. A trigger whose role is not `button` gets a development warning and keeps tap-only opening: every completed tap opens the card, and no press pins it. | DEC-1; WCAG 1.4.13, 2.1.1 | |
There was a problem hiding this comment.
The added useHoverCard sentence relaxes current FR9 ("does not reach a clickable row, card, or container around it"). Its approval was at an earlier head and binds to a head, so it needs an engineering owner's /approve-spec <full head SHA> here, or a rejection so useHoverCard stops the press.
| // interactive-ancestor walk, so a clickable container around the | ||
| // trigger leaves it alone; document listeners still see it. | ||
| ref={registerLayerSurface} | ||
| // The pin's announcement reads this element's text. |
There was a problem hiding this comment.
Non-blocking (comment style): this read is useHoverCard's own useAnnounceRenderedText call, not the press pin's. Suggest:
// An unlabelled pinned card's announcement reads this element's text.`component:HoverCard` FR9, FR10 and AR3, on the shared press pin (`Layer/usePressPin.ts`): - `triggerBehavior` on HoverCard and useHoverCard, with the closed-union type HoverCardTriggerBehavior (exported): `adaptive`, the default and the released behavior (a tap opens the card unless the trigger acts; an explicit `touchTrigger` still decides taps under it until the next minor); `hover` (touch never opens it); or `toggle`. Hover and focus preview it under every value. With `toggle` on a button trigger, a click, a tap, Enter, or Space pins the card and the same press closes it. - A pinned card stays until Escape, a second press, a press or scroll outside, or focus moving onto an element outside the trigger and the card (the pin listens for it on the trigger, whatever `focusTrigger` is); a press on its own content keeps it. It takes Escape before the layer beneath it, controlled or not. useHoverCard makes one usePressPin call, and a card whose `triggerBehavior` turns to `adaptive` while pinned closes on leave again. - The press stops at its trigger. The trigger carries aria-expanded and aria-controls on a button trigger; on any other trigger a labelled card keeps its own (FR3). When a press pins a card with a `label`, the press handler says the label once through useAnnounce (a controlled card says it each time its owner shows it pinned, as an unlabelled card's text is said, and nothing for a press the owner declines); otherwise the card's rendered text is announced once through useAnnounceRenderedText. - HoverCard.test.tsx: `adaptive` by default and explicitly, `hover`, and `toggle`, each under a mouse hover, focus, a tap, and a mouse click and a tap on a button trigger (which only the toggle pins), with `touchTrigger` beside each value (HoverCard FR5 and FR9's `triggerBehavior` row); and `useHoverCard` with a caller's trigger: its own onClick runs, an Astryx ClickableCard around it does not activate, and a plain onClick element around it receives the press unless the trigger's onClick stops it. - HoverCard FR9 states that `useHoverCard` clause, as Tooltip FR9 does for `anchorRef` and `useTooltip`; the changeset scopes the stop at the trigger to the HoverCard component. - HoverCard.test.tsx also stops a toggle press at its trigger inside an Astryx ClickableCard, an Item row, and a `<label>`. The HoverCard record links `Layer/usePressPin.ts` and `spec:AST-086` FR12 and FR14. - The HoverCard Space test presses Space down and up, as meta#9406's keyup timing needs. The API report lists HoverCard's three new rows.
b5931d2 to
bdde69a
Compare
|
Updated in bdde69a: the comment above the card's content now reads "An unlabelled pinned card's announcement reads this element's text.", as suggested. Nothing else changed. FR9's |
There was a problem hiding this comment.
Not ready to approve yet: one engineering-owner decision remains, and nothing else blocks.
- The sentence this pull request adds to the HoverCard spec's FR9 lets a plain
onClickelement around auseHoverCardcaller's trigger receive the pinning press, where FR9 today says that press never reaches a row, card or container around the trigger, and the earlier spec approval does not carry over to this head.
An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request (the author may, as an engineering owner), or rejects the sentence so useHoverCard stops the press as FR9 says today. The toggle itself matches the spec, and the earlier comment suggestion in useHoverCard.tsx is applied.
[Automated review]
Status: draft, stacked on #9361 (ed6c6cf), on main 9ae589b, which carries #9232 and #9406. Until #9361 merges, this branch carries its commit and this change (bdde69a). This change edits
HoverCard.spec.md, so it needs its own/approve-specat this head (pending). The gates under Testing ran at b5931d2, which differs from this head by one comment line; the checks named at this head ran here.Review only this pull request's change: vjeux/astryx@ed6c6cf...bdde69a
User need
A hover card that is the only home of its information (a profile card on an avatar button, the details behind an icon-only trigger) can't be kept open by touch, keyboard or screen-reader users. Hover opens it and leaving closes it; nothing pins it.
Problem and solution fit
triggerBehavior="toggle"makes the trigger a toggle, as it does for Tooltip in feat(Tooltip): triggerBehavior="toggle" pins the tooltip on a press #9232. On a button trigger, a click, a tap, Enter or Space pins the card, and the same press closes it. Hover and focus still preview it.spec:AST-003FR4, DEC-6).Current specification
component:HoverCardFR9, FR10, AR3 and DEC-1;spec:AST-003FR4 and DEC-6. All are current at 1d8696a (#9175). The prop's name and values,triggerBehavior('adaptive' | 'hover' | 'toggle', default'adaptive'), are the records pull request #9379's, merged as a68e0e3; this pull request is built on it, and the record lines it changes already use #9379's wording.Public delta and caller burden
triggerBehavior: 'adaptive' | 'hover' | 'toggle'onHoverCardanduseHoverCard, with the exported closed-union typeHoverCardTriggerBehavior. Hover and focus preview the card under every value.adaptive, the default, changes nothing: it is the released touch behavior, a tap opening the card unless the trigger performs an action of its own. Until CLN-0024 removestouchTrigger, an explicittouchTriggerstill decides taps under it.hover: touch never opens the card, and no press pins it (the releasedtouchTrigger="none").toggleon a button trigger (a<button>orrole="button"), a click, a tap, Enter or Space pins the card, and the same press closes it.focusTriggeris.onOpenChangeand doesn't change itself. A controlled labelled card says its label each time its owner shows it pinned, and nothing for a press the owner declines.aria-expanded(true only while pinned) andaria-controlswhile the card shows. When a press pins a card that has alabel, the press handler says that label once; otherwise the card's rendered text is announced once by the shared rendered-text announcer (spec:AST-086FR12), which keeps blocks apart and leaves hidden content out. Both reach a polite live region throughuseAnnounce, so inside a modal they're heard in the modal's own region (spec:AST-086FR14).aria-expanded/aria-controls(FR3) and tap-only opening, with a development warning.HoverCardcomponent the press stops at its trigger: a clickable row, card or container around it doesn't activate. WithuseHoverCardand a caller's trigger, the caller's own handlers still receive the press: the trigger'sonClickruns, Astryx clickable rows, cards and containers ignore it, and a plainonClickelement around the trigger receives it unless the trigger'sonClickstops it. HoverCard FR9 now states that clause, as Tooltip FR9 does foranchorRefanduseTooltip. (approved on feat(Tooltip): triggerBehavior="toggle" pins the tooltip on a press #9232); it needs the spec owners' approval at this head.triggerBehaviorturns toadaptivewhile pinned closes on leave again.triggerBehavior="hover"or"toggle",touchTriggeris ignored.API changes
Added public rows, decided by
component:HoverCardFR9 and FR10 (#9175). They go to human review underarchitecture:public-component-apiINV25.packages/core/api-report.mdlists exactly these rows.@astryxdesign/coreHoverCardProps.triggerBehavior?: HoverCardTriggerBehavior(default'adaptive')<HoverCard content={card} label="Profile" triggerBehavior="toggle"><button type="button">Ada</button></HoverCard>@astryxdesign/coreHoverCardOptions.triggerBehavior?: HoverCardTriggerBehavior(default'adaptive')useHoverCard({triggerBehavior: 'toggle'})@astryxdesign/coretype HoverCardTriggerBehavior = 'adaptive' | 'hover' | 'toggle'const mode: HoverCardTriggerBehavior = 'toggle';Design and alternatives
Layer/usePressPin.ts, which owns the layer's touch trigger, souseHoverCardmakes oneusePressPincall (architecture:react-component-runtimeINV16).labelis the dialog's name, a string and often shorter than the content, so the press handler says it throughuseAnnouncewith no Effect; a card without one is announced from its rendered text through the shared announcer (architecture:react-component-runtimeINV10).isPressPinTrigger).HoverCardTriggerBehavioris a closed union, asTooltipTriggerBehavioris.label, as an unlabelled card's rendered text is said. A press the owner declines says and arms nothing.Evidence
layerDismissalFamilies.test.tsxfail (2 of 2).triggerBehaviorturns toadaptivenever closes on leave; with fc05aff, afocusTrigger="never"card stays pinned when focus moves away.onOpenChange). With a flag that waits for the press, an owner-opened card with no press says nothing, and the declined-then-opened case fails. Without the press'spreventDefaultand click mark, the Item-row stop case fails. The ClickableCard and<label>stop cases pass there too in jsdom: the card's container walk and jsdom's label activation already skip a button trigger.HoverCard.test.tsxtriggerBehavioron every input (24 cases):adaptiveby default and explicitly,hover, andtoggle, each under a mouse hover, focus, a tap on an info-only trigger (which opens it or never opens it), and a mouse click and a tap on a button trigger, which only the toggle pins; withtouchTriggerbeside each value. It fills HoverCard's "FR5, FR9 (triggerBehavior)" verification row. Without feat(Tooltip): triggerBehavior="toggle" pins the tooltip on a press #9232'shovermapping, 2 cases fail; withadaptivepinning a button as the toggle does, the fouradaptivebutton cases fail.HoverCard.test.tsxstop cases: a toggle press inside an AstryxClickableCard, an Item row (with arole="button"trigger, which Item's row click does not skip by itself), and a<label>pins the card and activates nothing around it.HoverCard.test.tsxuseHoverCardcaller-trigger cases: under the toggle, the trigger's ownonClickruns and an AstryxClickableCardaround it does not activate; a plainonClickelement around it receives the press unless the trigger'sonClickstops it (HoverCard FR9'suseHoverCardclause).Layer/usePressPin.test.tsx(14 HoverCard tests): click, tap, Enter and Space pin; a second press, a press outside and focus leaving close it; pointer leave and presses on the card keep the pin, including a press on its own text that moves focus to no element;triggerBehaviorturning tohoverwhile pinned; focus moving away underfocusTrigger="never"; a labelled card saying its label once when a press pins it, and a controlled one each time its owner shows it pinned, after a declined press too, and nothing for the declined press; an unlabelled card saying its own text once, paragraphs apart; the stop; a labelled card on a non-button trigger keeping its own popup state, with the development warning, and a tap still opening a card on such a trigger.layerDismissalFamilies.test.tsx: an uncontrolled and a controlled pinned HoverCard over a Dialog each take Escape first, and the Dialog stays open.Layer/usePressPin.calls.test.tsx:useHoverCardmakes oneusePressPincall per render, and every touch-trigger call comes from inside it.hooks/useAnnounceRenderedText.adopters.test.tsx: an unlabelled HoverCard pinned by a press hands its text to the shared announcer and announces none of it itself; the registry check listsuseHoverCardas an adopter.TouchTrigger.a11y.chromium.spec.ts: under a mouse in Chromium, a pinned unlabelled card is announced as "Ada Lovelace Analyst, Payments", its paragraphs apart, and a click on its text keeps the pin (newHoverCardTogglestory).useHoverCardclause, mirroring Tooltip FR9's approvedanchorRef/useTooltipclause, for the spec owners' approval at this head; its verification rows cite the tests above (added toverified_by).system_specsaddsspec:AST-086/FR12and/FR14, and apath-applicabilityblock linksLayer/usePressPin.ts.Why it is split
The HoverCard wiring (about 580 lines, under
component:HoverCardFR9, FR10 and AR3) is its own pull request, stacked between #9361 (above #9406 and #9232) and #9246, by the maintainers' ruling. All five ship in the same release. This one is 16 files, +1,050/−100: HoverCard's wiring, its tests and story, its record and docs, its changeset, the shared hook's notes naming HoverCard, and HoverCard's API report rows. HoverCard fixes #9592, #9593, #9597, and #9603 touch the same files; whichever lands second rebases.Scope
Writing rubric results
The rubric in
docs/contributing/spec-writing.md, over the changed parts ofHoverCard.spec.md:Testing
Local gates at b5931d2 (on #9361's ed6c6cf, on main 9ae589b). This head, bdde69a, changes one comment line in
useHoverCard.tsx; at this head, coretsc(0 errors), strict ESLint and Prettier on that file, and the HoverCard, Layer, and hooks suites (1,146 tests) pass.pnpm check:knowledge,pnpm check:changesets,pnpm check:i18n-runtime, coretsc(0 errors),ASTRYX_STRICT_LINT=1 pnpm lint(0 errors), Prettier on the touched files, and the Storybook build. The touched.doc.mjsfiles stay unformatted, as on main, and load.pnpm buildandpnpm api:report --package corewrite exactly this pull request's four HoverCard rows. Apart from them, the regenerated file differs from the committed one only by main's own TextArea and TextInput rows (feat(TextInput,TextArea): tell a touch keyboard what the field holds #8166), which main's report also lacks.pnpm test:ui: 741 files, 18,530 tests pass.pnpm test:node: 16,045 pass, with 2 expected failures.TouchTrigger.a11y.chromium.spec.tsin Chromium: 22 of 22, twice, the HoverCard mouse case included..a11y.browser.spec.tsspecs, ten times each: 220 of 220. They run in the CI profile: the Playwright 1.61.1 image, 4 CPUs,CI=1,LP_NUM_THREADS=4, and one worker.