Skip to content

Core: one hover-intent machine for tooltips and hover cards (A of #376) - #410

Merged
samitbasu merged 4 commits into
mainfrom
hover-376a
Nov 19, 2026
Merged

samitbasu merged 4 commits into
mainfrom
hover-376a

Conversation

@samitbasu

Copy link
Copy Markdown
Owner

Part of #376 (PR A of three: A, the hover-intent generalisation; B, the hover_anchored primitive; C, the extras widget).

What

Tooltips (in src/tooltip.rs) becomes intent::Intent<P> in src/intent.rs, a hover-intent machine that is generic over what an instance shows. It takes a Timing { open, close, skip, focus }:

  • close (new): how long the open trigger stays once nothing wants it. It is zero for tooltips, so they close at once as before.
  • skip: Grace(d) is the tooltip's existing skip-delay. Never is for hover cards (no skip-delay, per the decisions).
  • focus: AtOnce (tooltips) or AfterDelay (cards, per the decisions).

The latch, focus restore, deepest-wins wanted and the rule that the trigger around the last one waits are all unchanged. Tooltips keep the payload of their content and style as Shows.

Tests

The machine's unit tests move with it to src/intent.rs, with the same assertions. New tests cover the close delay and what is left of it, coming back within it, focus waiting for the delay, no grace while the last one lingers, and an interruption closing a lingering one.

Behaviour changes

None. Tooltips run with close = 0, Grace(style.tooltip.grace) and AtOnce, which is the old machine. The test outcomes are identical.

cargo xtask ci: exit 0.

🤖 Generated with Claude Code

…#376)

Hover cards (#376) open and close by hover intent like tooltips, with a
close delay, focus that waits for the open delay, and no skip-delay. The
design note asks for one machine rather than a sibling timer, so
`Tooltips` becomes `intent::Intent<P>`, generic over what an instance
shows, with a `Timing { open, close, skip, focus }`:

- `close`: how long the open trigger lingers once nothing wants it. Zero
  for tooltips, which close at once as before.
- `skip`: `Grace(d)` is the tooltip's skip-delay; `Never` is for cards.
- `focus`: `AtOnce` (tooltips) or `AfterDelay` (cards).

The latch, focus restore, deepest-wins `wanted` and the "not the trigger
around the last" rule are unchanged. The machine's tests move with it to
`src/intent.rs`, assertion for assertion; new tests cover the close
delay, coming back within it, focus waiting, no grace, and an
interruption closing a lingering one.

Behaviour changes: none. Tooltips use close = 0, Grace(style.grace) and
AtOnce, which is the old machine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKe8zfqGfVMCSC5L3up
samitbasu and others added 3 commits November 19, 2026 10:02
The refused control's press (Cause::Pressed, a pinned show) is ported onto
the shared Intent machine: Press and Tooltip::refusal stay in tooltip.rs,
the pinned show and the cause's order in intent.rs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AJYxo4YJZUXcPJ1bHdAHKy
@samitbasu

Copy link
Copy Markdown
Owner Author

Approved by the user on its tests (2026-11-19). GitHub's required checks pass on the branch merged with current main. Merging.

@samitbasu
samitbasu merged commit 6ed4349 into main Nov 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant