Repository navigation
Core: OverlayChain::hover_anchored, the hover card primitive (B of #376) - #412
Merged
Merged
Conversation
…rt of #376) The core primitive of the hover card (#376). `hover_anchored(trigger, HoverIntent)` on an unplaced overlay chain supplies both the anchor (the identified node `trigger`) and `shown`, which comes from a second instance of the hover-intent machine (`Kept::hover_cards`), next to the tooltips' own: one shared instance would close a card when a tooltip inside it opens. - `hover.rs` registers each declared card at build, and at the end of the draw, after dismissal is judged, resolves the triggers: the pointer over the trigger (whole-control), keyboard focus within it, and, while the card is open, the pointer over its box or an overlay nested in it, or a press that started there and is still held. The box counts as the trigger, so the pointer may cross the gap within the close delay. - Dismissals of `dismiss.rs` (Esc, a press outside, focus leaving, blur) are fed back to the machine as an interruption, which latches the card closed until the trigger is left, as tooltips latch. A press on the trigger closes it too, and the press passes through (`PassThrough`). - Focus waits for the open delay and never moves in (`Focus::None`); the card's nodes are off the Tab order. - Touch never opens a card: a per-viewport "the last pointer input was a touch" fact beside `keyboard_was_last`. - The card's trigger takes the tooltip slot of its subtree: tooltips of nodes inside it are dropped by ancestry, and one around it yields while the card trigger is wanted for the same cause. Tooltips inside the card work as usual. - `HoverIntent::description` describes the trigger's focusable widgets to assistive technology, after their own tooltips' text. - A card declared inside another card is reported as `Problem::NestedHoverCard` and never opens. New public API: `OverlayChain::hover_anchored`, `overlay::HoverIntent`, `Builder::description_of` (the text of a body while accesskit is on, the tooltip's existing path made public for the extras' content), and `Problem::NestedHoverCard`. The name `hover_anchored` is the design note's placeholder, for the user to confirm. `Band::Tooltip`'s doc no longer claims hover cards: they sense, so they are `Band::Popup`. Behaviour changes: none for tooltips without hover cards. With a card, the tooltips of and around its trigger yield to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PWiKKe8zfqGfVMCSC5L3up
Owner
Author
|
Name confirmed by the user (2026-11-19): |
Main's report_outgrown and this branch's accesskit_is_on both stay in builder.rs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AJYxo4YJZUXcPJ1bHdAHKy
Owner
Author
|
Approved by the user after the hover-card trial (2026-11-19). GitHub's required checks pass on the branch merged with current main. Merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #376 (PR B of three). It is built on #410 (A), and its diff against main includes A's commit, so please review it after A. Against A it adds 14 files changed, 1034 insertions(+), 38 deletions(-).
The name is for you to pick
hover_anchoredis the design note's placeholder (Q10). The alternatives wereopened_by_hoverandhover_intent.API
OverlayChain<Unplaced, Static>::hover_anchored(trigger: Id, intent: HoverIntent) -> OverlayChain<Floating, Animated>supplies both the anchor (Anchor::Node(trigger)) andshown.overlay::HoverIntent { open: Duration, close: Duration, description: Option<String> }is#[non_exhaustive], built withnew(open, close)and.description(text).Builder::description_of(salt, body) -> Option<String>is new public API. It returns the text thatbodyshows while accesskit is on, andNonewhile it is off. It is the tooltip's existing path made public, so that the extras card (C) can describe its trigger. The design note had pointed at the internaltext_of.Problem::NestedHoverCardis new.Behaviour
These follow the decisions on #376.
open. Focus also waits foropen, and it does not move into the card (Focus::None). There is no skip-delay between cards.close.dismiss.rsrules and are fed back to the machine as an interruption. A press on the trigger also closes the card, and the trigger's click still lands (Outside::PassThrough). After any of these, the card stays closed until the trigger is left, as a tooltip does.descriptionis set on the trigger's focusable widgets, after the text of their own tooltips. The trigger gets noexpanded/has_popupwhile the card is open, which matches Radix.Band::Popup. The doc ofBand::Tooltipno longer mentions hover cards.Behaviour changes: none for apps without hover cards. Where there is a card, the tooltips of and around its trigger yield to it, as decided.
Tests
tests/it/hover_anchored.rshas 15 tests that go through the full draw path. Each asserts its geometric preconditions. They cover:cargo xtask ci: exit 0.🤖 Generated with Claude Code