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.
This needs an engineering-owner decision before it can be approved. The head rewrites component:Tooltip FR9 so that, with anchorRef or a useTooltip caller's trigger, a plain onClick ancestor still receives the pinning press, and the current FR9 stop clause does not allow that. An engineering owner records the decision by commenting /approve-spec followed by the full head SHA on this pull request, and the author may do so as an engineering owner. Whatever the decision, these still need changes:
- An own-text trigger inside a Table row that expands on click also expands the row. The press-pin guard is only in
useClickableContainer, not in the Table row handlers that share its checks. - The changeset says a clickable row around a
useTooltiptrigger does nothing, but a plainonClickrow still receives the press from the hook. - With #9232's commit included, this is 2,068 authored lines. Landing #9232 first and rebasing would leave only this change's 163 lines.
[Automated review]
| | 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 new sentence "With anchorRef, or useTooltip with a caller's trigger, … a plain onClick element around the anchor receives it" is a carve-out from the current FR9 stop clause ("does not reach a clickable row, card, or container around it"). An engineering owner needs to approve it, or the anchorRef and hook paths need to conform.
| if (disabled) { | ||
| // A press that pinned or closed a hover layer stops at its trigger: the | ||
| // container does not act on it (component:Tooltip FR9). | ||
| if (disabled || isPressPinClick(event.nativeEvent)) { |
There was a problem hiding this comment.
The guard only covers the hook's own onClick. The Table row-expansion and tree-data row clicks share this hook's checks through hasInteractiveAncestor and miss it, so an own-text trigger in a clickable Table row both pins and expands the row. Moving the check into the shared predicate, or adding it to both row handlers, keeps the three surfaces aligned.
| '@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.
For useTooltip, "a clickable row, card, or label around it does nothing" is not what the hook does: a plain onClick row still receives the press (the head's useTooltip.doc.mjs says so). Naming useTooltip beside anchorRef in the exception sentence fixes it.
d35f344 to
f3f40ea
Compare
There was a problem hiding this comment.
This needs an engineering-owner decision before it can be approved: the head adds a sentence to component:Tooltip FR9 under which a plain onClick element around an anchorRef or useTooltip trigger still receives the pinning press, and the current FR9 stop clause does not allow that. An engineering owner records the decision by commenting /approve-spec followed by the full head SHA on this pull request (the author may do so as an engineering owner), or asks for the anchorRef and hook paths to conform. Whatever the decision, these still need changes:
- An own-text trigger pins and also activates an Item or TreeList row with
onClickor a Table row that expands on click, and an anchoredrole="button"trigger activates an Item row, because onlyuseClickableContainerreads the press-pin mark. - The re-wire Effect in
usePressPin.tsleavesrepeatsTriggerTextout of its settle key and dependencies, so turning the option on after mount never wires the trigger. - With #9232 and #9406 included this is 2,286 authored lines; landing them first and rebasing onto
main, which also clears the conflicts inTooltip.spec.md,useTooltip.tsxanduseTooltip.doc.mjs, leaves this change's 163 lines.
[Automated review]
| if (disabled) { | ||
| // A press that pinned or closed a hover layer stops at its trigger: the | ||
| // container does not act on it (component:Tooltip FR9). | ||
| if (disabled || isPressPinClick(event.nativeEvent)) { |
There was a problem hiding this comment.
This is the only place the press-pin mark is read. An Item row with onClick (Item.tsx handleContainerClick), a TreeList row with onClick (TreeListItem.tsx handleClick) and the Table row-expansion and tree-data rows don't go through this onClick, so an own-text trigger pins and also activates those rows, and an anchored role="button" trigger activates an Item row. Reading the mark in the walk they share (or in each handler) keeps FR9's stop clause for all of them.
| // it here: the host's ref callback does not run again for that change. | ||
| useEffect(() => { | ||
| wire(offeredRef.current); | ||
| }, [triggerBehavior, wire]); |
There was a problem hiding this comment.
wire reads repeatsTriggerText, but neither this Effect's dependencies nor the settle key (element and triggerBehavior) include it, so a tooltip whose repeatsTriggerText turns true after mount never wires its trigger. Adding it to both fixes that.
| | 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 new sentence "With anchorRef, or useTooltip with a caller's trigger, … a plain onClick element around the anchor receives it" is an exception to the current stop clause ("does not reach a clickable row, card, or container around it"). It needs an engineering owner's /approve-spec for this head, or the anchorRef and hook paths should conform.
f3f40ea to
3ce583c
Compare
There was a problem hiding this comment.
This needs an engineering-owner decision before it can be approved: the head adds a sentence to component:Tooltip FR9 under which a plain onClick element around an anchorRef or useTooltip trigger still receives the pinning press, and the current FR9 stop clause does not allow that. An engineering owner records the decision by commenting /approve-spec followed by the full head SHA on this pull request (the author may do so as an engineering owner), or asks for the anchorRef and hook paths to conform. Whatever the decision, these still need changes:
- An own-text trigger pins and also runs an Item or TreeList row with
onClickor a Table row that expands on click, and an anchoredrole="button"trigger runs an Item row, because onlyuseClickableContainerreads the press-pin mark. - The re-wire Effect in
usePressPin.tsleavesrepeatsTriggerTextout of its settle key and dependencies, so turning the option on after mount never wires the trigger. - With #9232 and #9406 included this is 2,360 authored lines; landing them first and rebasing leaves this change's 163 lines.
[Automated review]
| if (disabled) { | ||
| // A press that pinned or closed a hover layer stops at its trigger: the | ||
| // container does not act on it (component:Tooltip FR9). | ||
| if (disabled || isPressPinClick(event.nativeEvent)) { |
There was a problem hiding this comment.
This is the only place the press-pin mark is read. An Item row with onClick (Item.tsx handleContainerClick), a TreeList row with onClick (TreeListItem.tsx handleClick) and the Table row-expansion and tree-data row clicks (hasInteractiveAncestor) never call this onClick, so on this head an own-text trigger pins and also runs those rows, and an anchored <span role="button"> runs an Item row. A shared check here that answers true for isPressPinClick(event.nativeEvent), called from those four handlers, would cover them; Item, TreeList and Table row cases beside the ClickableCard one would prove it.
| useEffect(() => { | ||
| wire(offeredRef.current); | ||
| }, [triggerBehavior, wire]); |
There was a problem hiding this comment.
wire reads repeatsTriggerText (line 475), but neither this Effect's dependencies nor the settle key (element and triggerBehavior, lines 462-470) include it, so a tooltip whose repeatsTriggerText turns true after mount never wires its trigger and a click pins nothing. Adding it to both fixes it.
| | 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 new sentence "With anchorRef, or useTooltip with a caller's trigger, … a plain onClick element around the anchor receives it" is an exception to the current stop clause ("does not reach a clickable row, card, or container around it"). It needs an engineering owner's decision at this head, or the anchorRef and hook paths need to conform. Separately, "Astryx clickable rows, cards, and containers ignore it" does not hold yet for Item rows with a role="button" anchor.
3ce583c to
91a3809
Compare
There was a problem hiding this comment.
This needs an engineering-owner decision before it can be approved. The head adds a sentence to component:Tooltip FR9 under which a plain onClick element around an anchorRef or useTooltip trigger still receives the pinning press, which the current FR9 stop clause does not allow. An engineering owner records the decision by commenting /approve-spec followed by the full head SHA on this pull request (the author may do so as an engineering owner), or asks for the anchorRef and hook paths to conform. Whatever the decision, these still need changes:
- An anchored
role="button"trigger in an Item row, and an own-text trigger in an Item or TreeList row or a Table row that expands on click, pins the tooltip and also runs the row because onlyuseClickableContainerreads the press-pin mark, although the changeset and docs say Astryx rows ignore the press. - The re-wire Effect in
usePressPin.tsleavesrepeatsTriggerTextout of its settle key and dependencies, so turning it on after mount never wires the trigger. - With the stacked toggle work included this is 2,360 authored lines; landing those pull requests first and rebasing leaves this change's 163 lines.
[Automated review]
| if (disabled) { | ||
| // A press that pinned or closed a hover layer stops at its trigger: the | ||
| // container does not act on it (component:Tooltip FR9). | ||
| if (disabled || isPressPinClick(event.nativeEvent)) { |
There was a problem hiding this comment.
This is the only place the press-pin mark is read. Item rows with onClick (Item.tsx handleContainerClick), TreeList rows with onClick (TreeListItem.tsx handleClick) and the Table row-expansion and tree-data row clicks never call this onClick. On this head an anchored <span role="button"> trigger pins and also runs an Item row, and an own-text trigger runs all four. One shared check that answers true for isPressPinClick(event.nativeEvent), called from those handlers too, keeps FR9's stop for every Astryx row.
| useEffect(() => { | ||
| wire(offeredRef.current); | ||
| }, [triggerBehavior, wire]); |
There was a problem hiding this comment.
wire reads repeatsTriggerText (line 475), but neither this Effect's dependencies nor the settle key (lines 462-470, element and triggerBehavior) include it. A tooltip whose repeatsTriggerText turns true after mount never wires its trigger, so a click pins nothing. Adding it to both fixes this.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [feat] Tooltip (and `useTooltip`) take `triggerBehavior` (type `TooltipTriggerBehavior`): `adaptive`, the default and the released behavior, where hover and focus preview the tooltip and a tap opens it unless the trigger performs an action of its own; `hover`, where hover and focus preview it and no touch or pen tap 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 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`, or `useTooltip` with a caller's trigger, nothing is rendered around the trigger to stop it: the trigger's own `onClick` runs, Astryx clickable rows, cards, and containers ignore the press, and a plain `onClick` element around the trigger receives it unless the trigger'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; `touchTrigger` decides taps only under `adaptive`; `hover` and `toggle` ignore it. |
There was a problem hiding this comment.
"Astryx clickable rows, cards, and containers ignore the press" does not hold yet: an anchored role="button" trigger inside an Item row with onClick still runs the row. Either extend the guard to Item, TreeList and Table rows, or narrow this to the surfaces built on useClickableContainer's onClick.
| | 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 new sentence "With anchorRef, or useTooltip with a caller's trigger, … a plain onClick element around the anchor receives it" is an exception to the current stop clause ("does not reach a clickable row, card, or container around it"). It needs an engineering owner's decision at this head, or the anchorRef and hook paths need to conform.
91a3809 to
eadb464
Compare
|
Updated in eadb464, restacked on #9406's 795ae5a. #9232 now records the Item-row gap in FR9, with a current-state item, and names it in its changeset, docs and JSDoc; this change removes all of them with the fix.
|
There was a problem hiding this comment.
This needs an engineering-owner decision before it can be approved. The head adds a sentence to component:Tooltip FR9, and an "FR9 (anchorRef)" verification row, under which a plain onClick element around an anchorRef or useTooltip trigger still receives the pinning press, while the current FR9 says that press stops at its trigger and does not reach a clickable row, card, or container around it. An engineering owner settles it by commenting /approve-spec followed by the full head SHA on this pull request (the author can do this as an engineering owner), or by asking for the anchorRef and hook paths to conform to the current stop clause.
Still required either way:
- With the stacked toggle work included, this pull request is 2,797 authored lines; landing the two stacked pull requests first and rebasing leaves this change's 438 lines.
The earlier row-guard, changeset wording and re-wire Effect findings are fixed, and two non-blocking comment suggestions are inline.
[Automated review]
| | 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 new sentence "With anchorRef, or useTooltip with a caller's trigger, … a plain onClick element around the anchor receives it unless the anchor's onClick stops it" is an exception to the current FR9 stop clause ("does not reach a clickable row, card, or container around it"). It needs an engineering owner's /approve-spec at this head, or the anchorRef and hook paths need to conform. The verification row at line 325 and "around a child trigger" at line 324 go with it.
| setIsPinnedState(next); | ||
| }, []); | ||
|
|
||
| // Refs hold the wired trigger and last offered element for a later rewire. |
There was a problem hiding this comment.
Non-blocking (comment style): this restates triggerRef and offeredRef. Keep only the reason, for example "A mode change wires the last offered element again."
| [wire], | ||
| ); | ||
|
|
||
| // A button, or any trigger whose layer repeats its own text. |
There was a problem hiding this comment.
Non-blocking (comment style): this restates the isWired expression below it; it can go.
…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.
eadb464 to
ed6c6cf
Compare
|
Rebased onto main 9ae589b, which carries #9232 and #9406, so this branch now carries only its own commit: ed6c6cf, 14 files, +373/−64.
This head needs a spec owner's |
There was a problem hiding this comment.
Approval recommended: the Item, TreeList, Table row and clickable-container guards make the pinning press behave as component:Tooltip FR9 already states, and the internal own-text option matches FR9's own-text clause. The six new row and container tests fail against the base's rows and pass here.
- Before merge, the Tooltip record edit still needs an engineering owner's spec approval at this head (
/approve-spec <full head SHA>), and CI ran no jobs while the pull request is a draft. - Optional: the doc comment on the click set in
packages/core/src/Layer/pressPinClick.tsonly restates its name; delete it or keep a reason.
[Automated review]
| * the mark without loading the press pin itself (usePressPin.ts). | ||
| */ | ||
|
|
||
| /** The clicks that a press pin answered. */ |
There was a problem hiding this comment.
Non-blocking (comment style): this restates the name pressPinClicks, and the move dropped the reason the old comment carried. Delete it, or keep only a reason, for example "Weak, so no click outlives its dispatch."
humbertovirtudes
left a comment
There was a problem hiding this comment.
Table-scoped review of exact head ed6c6cfce93457f76965b02b5a96a96f5b810650.
The historical Table row/tree guards correctly check the marked native event, and #9291 contains those exact ancestor Table blobs rather than another authored fix. Current main has since replaced the automatic pin/toggle owner and removed the internal mark producer. Reconcile the surviving Table requirement with the current Tooltip/InfoTip owner instead of reviving the removed triggerBehavior path merely to keep this guard live. No new Table source defect is asserted at this historical head. Draft/runtime evidence and current-owner integration remain held.
|
Thanks. Agreed: main (#9756) replaced the automatic pin/toggle owner, so we won't revive the removed |
|
Superseded by #9756, which replaced the automatic pin/toggle owner with |
Status: draft, on main 9ae589b, which carries #9232 and #9406. This branch carries only this change (ed6c6cf). It edits
Tooltip.spec.md, so it needs its own/approve-specat this head (pending). Every gate under Testing ran at this head, on main 9ae589b.Review this pull request's change: https://github.com/meta/astryx/pull/9361/files
User need
A truncated Text that is its own tab stop has a tooltip that repeats its full text. Under
triggerBehavior="toggle",component:TooltipFR9 lets that trigger pin its tooltip without being a button, so touch and keyboard users can keep the full text open. It gets no toggle state and no announcement, since its text is already the trigger's content.Problem and solution fit
repeatsTriggerTextoption on the shared press pin, passed throughuseTooltipInternal, pins such a trigger on a press. It gets no development warning, noaria-expandedoraria-controls, and no announcement (FR9's own-text clause). The option joins the pin's settle key and its re-wire Effect, so turning it on after mount wires the trigger.role="button"element, which an Item row's own check misses. The pin marks each click it answers, and every Astryx clickable surface ignores a marked click:useClickableContainer(ClickableCard, SelectableCard, TokenLink, FileInput, Overlay, and link rows), Item rows, TreeList rows, and the Table row-expansion and tree-data row clicks.Current specification
component:TooltipFR9, its own-text clause, 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. The row change follows FR9's sentence from #9232: withanchorRef, oruseTooltipwith a caller's trigger, "Astryx clickable rows, cards, and containers ignore" the pinning press.Public delta and caller burden
No API change. The
repeatsTriggerTextoption is internal (useTooltipInternalis@internal), and no component passes it yet. One observable change: an anchored or hook-wiredrole="button"trigger that is not a native button now pins inside an Item row without running the row, as FR9 states. TreeList rows, click-expanding Table rows, and theuseClickableContainersurfaces already skipped such a trigger; their new check covers the internal own-text trigger. There is no caller burden. It is unreleased, and ships in the same release as #9232.API changes
None.
Design and alternatives
Layer/pressPinClick.ts, with no imports. Rows and containers read it without loading the press pin, so their bundles don't grow.Evidence
role="button"trigger in an Item row, and the own-text trigger in an Item row, a TreeList row, a Table row that expands on click, and a tree-data row. WithrepeatsTriggerTextleft out of the settle key and the re-wire Effect, the after-mount case fails.Layer/usePressPin.test.tsx:role="button"trigger in an Item row pins, and the row does not activate;TooltipanduseTooltipJSDoc, andTooltip.doc.mjs(English and Chinese) anduseTooltip.doc.mjstexts name goes as well.Why it is split
#9232 was over the 2,000-line review threshold, and this unit separates cleanly. No component passes the option yet. This pull request is 14 files, +373/−64. All five (#9232, #9406, this one, #9291, and #9246) ship in the same release.
Scope
Writing rubric results
The rubric in
docs/contributing/spec-writing.md, over the changed parts ofTooltip.spec.md:Testing
Local gates at this head, ed6c6cf (on main 9ae589b):
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.usePressPin.test.tsxandusePressPin.calls.test.tsx: 48 of 48, with the red cases above failing on main's rows, containers, and settle key. The Layer, Tooltip, and HoverCard suites: 559 tests pass.pnpm test:ui: 741 files, 18,479 tests pass.pnpm test:node: 16,045 pass, with 2 expected failures.TouchTrigger.a11y.chromium.spec.tsin Chromium: 21 of 21, twice..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.