Skip to content

Respect overflow clipping in hit-testing - #1324

Open
nicoburns wants to merge 2 commits into
mainfrom
hit-test-overflow-clip
Open

nicoburns wants to merge 2 commits into
mainfrom
hit-test-overflow-clip

Conversation

@nicoburns

@nicoburns nicoburns commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Node::hit_inner recursed into children whenever the point was inside the node's scrollable overflow or content rect, even when the node clips. So content overflowing an overflow: hidden ancestor stayed clickable in the region that was clipped away. Example: DuckDuckGo's .frm__select { overflow: hidden; width: 145px } wraps select { width: 140% }, so clicks to the right of the visible box still opened the select (found while testing #1321).

Descendant hits are now clipped per axis at the padding edge, plus overflow-clip-margin, whenever a node clips on that axis. Scroll offsets and transforms are handled. Hoisted (positioned) descendants walk their containing-block chain, so an abspos child whose containing block is outside the clipping element still escapes the clip, matching paint. The containment predicate is extracted from blitz-paint/src/render.rs and shared; paint behaviour is unchanged.

Local WPT: css/css-overflow/overflow-clip-margin-hit-testing.html goes FAIL → PASS. The rest of css/css-overflow and the elementFromPoint*/elementsFromPoint* tests are unchanged.

Not changed:

  • clip-path hit-testing.
  • Paint still clips both axes when either axis clips, and ignores overflow-clip-margin.

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/55516ded5eb14b35b0c9bca6b400ca61
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/55516ded5eb14b35b0c9bca6b400ca61?variant=devin-insiders

WPT results

Subtests: 6 newly passing, 0 newly failing (net +6).

Subtest changes by area (7 areas)
+ css              | +6 (+6 / -0) | 59.64% -> 59.64% (+0.00%) | 118840 -> 118846 / 199259
+   CSS2           | +1 (+1 / -0) | 78.83% -> 78.84% (+0.01%) |   6954 ->   6955 /   8822
+     floats       | +1 (+1 / -0) | 74.89% -> 75.33% (+0.44%) |    170 ->    171 /    227
+   css-borders    | +2 (+2 / -0) | 62.96% -> 63.07% (+0.11%) |   1115 ->   1117 /   1771
+     border-shape | +2 (+2 / -0) | 12.34% -> 13.64% (+1.30%) |     19 ->     21 /    154
+   css-break      | +2 (+2 / -0) | 16.23% -> 16.33% (+0.10%) |    320 ->    322 /   1972
+   css-overflow   | +1 (+1 / -0) | 38.16% -> 38.22% (+0.06%) |    677 ->    678 /   1774
Full diff (5 changed tests)
+ FAIL => PASS  [1/1]  +1  css/CSS2/floats/hit-test-floats-005.html
+ FAIL => PASS  [3/3]  +1  css/css-borders/border-shape/border-shape-overflow-clip-margin-hit-test-ref-boxes.html
+ FAIL => PASS  [1/1]  +1  css/css-borders/border-shape/border-shape-overflow-clip-margin-hit-test.html
+ FAIL => PASS  [4/4]  +2  css/css-break/hit-test-hidden-overflow.html
+ FAIL => PASS  [1/1]  +1  css/css-overflow/overflow-clip-margin-hit-testing.html

Generated by the WPT workflow.

@staging-devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

This branch has not been deployed

No deployments
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