fix(agent): press a control the renderer laid out flat - #54
Merged
Merged
Conversation
`Click` is dispatched at a node id: `activate_agent_node` sends every phase with `DomEvent::new(node_id, ..)`, and the coordinate it resolves first is only the number the event carries in `clientX`/`clientY`. It shared its resolver with `Hover`, which really does move a pointer to a point, and that resolver refused any node whose box had no area. So one predicate stood for two facts, and the wrong one won for a whole class of control. Anything sized entirely by its label -- a bare `<a>`, a trigger with no padding -- lays out at zero height on a host with no font catalogue, which is what a Linux CI runner is and what `qa-inspect-host` is on any platform since it stopped enabling `system-fonts`. Measured on the @pathscale/ui sweep: Dialog's and Popover's triggers, Link, Collapsible and Composer's Send all report `0x0` with no fonts and `78x24`, `92x24`, `25x20`, `71x24` and `31x21` with them. Attached, styled visible, enabled, handlers intact; unpressable for want of a coordinate none of them would have used. The requirement is a parameter now. `Hover` keeps it and says why it failed; `Click` and `DoubleClick` do not. Everything that is a reason not to press still refuses: the node must exist, be attached with valid layout ancestry, not be `display: none`, `visibility: hidden`, `hidden` or `aria-hidden`, and not be disabled. None of those is a box size. Three tests, with the degenerate case asserted first so a pass cannot be vacuous: a flat control is pressable, the same control still refuses a hover, and a `display: none` control is still refused outright.
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.
What was wrong
AgentAction::Clickis dispatched at a node id:activate_agent_nodesends every phase withDomEvent::new(node_id, ..). The coordinate it resolves first is only the number the event carries inclientX/clientY.It shared
resolve_agent_nodewithHover, which really does move a pointer to a point — and that resolver refused any node whose box had no area. One predicate standing for two facts, and the wrong one won for a whole class of control.What it cost
Anything sized entirely by its label lays out at zero height on a host with no font catalogue — which is what a Linux CI runner is, and what
qa-inspect-hostis on any platform since it stopped enablingsystem-fonts.Measured on the
@pathscale/uicomponent sweep, same page, same build, only the font catalogue differing:button:Open dialog0x0, hidden78x24, visiblebutton:Open popover0x0, hidden92x24, visiblelink:Link0x0, hidden25x20, visiblebutton:Collapsible0x0, hidden71x24, visiblebutton:Send(Composer)0x0, hidden31x21, visibleAll five are attached, styled visible, enabled, with working handlers. All five were unpressable for want of a coordinate none of them would have used. A
<Button>was unaffected: its padding gives it26x36with no glyph at all.The change
The area requirement is a parameter.
Hoverkeeps it, and now says why it failed (no layout box a pointer can reach);ClickandDoubleClickdo not.Everything that is a genuine reason not to press still refuses: the node must exist, be attached with a valid layout ancestry, not be
display: none/visibility: hidden/hidden/aria-hidden, and not be disabled. None of those is a box size.Tests
Three, with the degenerate case asserted before the behaviour so a pass cannot be vacuous:
display: nonecontrol is still refusedcargo test -p tauri-runtime-blitz --all-features— 41 pass, 0 fail.cargo clippy --all-targets --all-features -D warnings— clean.Note on the snapshot's
visibleSemanticNode.visibleisnode_is_visible(..) && rect has area, so it conflates "the author hid this" with "the renderer gave it no area". That is why this was hard to see: adisplay:nonecontrol and a flat one are indistinguishable to a consumer. Not changed here — it is a protocol-shaped decision — but worth recording.