fix(anchor): make the whole WAnchor bounds tappable via translucent hit-test#152
fix(anchor): make the whole WAnchor bounds tappable via translucent hit-test#152anilcancakir wants to merge 4 commits into
Conversation
…it-test
WAnchor's GestureDetector used the default HitTestBehavior.deferToChild, so it
only received a pointer when a painted child sat under the tap point. An anchor
wrapping transparent content (a settings row with its label on one side, a
link, an icon row) then ignored taps that landed on its empty regions: a real
user tapping the blank part of the row, and every centre-of-element tap from a
driver (dusk / Playwright), silently did nothing. The existing tap tests all
worked around this with an opaque Container child ("Ensure hit-testable").
Set behavior: HitTestBehavior.translucent so the whole anchor bounds are the
hit target, matching the whole-box tap WInput and WPopover already use. Adds a
regression test that taps a transparent region of the anchor and asserts onTap
fires.
|
Warning Review limit reached
Next review available in: 1 minute Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesWAnchor hit testing
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes WAnchor hit-testing so taps register anywhere within the anchor’s bounds (including transparent/empty regions), by setting the inner GestureDetector to use HitTestBehavior.translucent. This aligns anchor behavior with other interactive Wind widgets and improves both real-user taps and driver-style “center of element” taps.
Changes:
- Update
WAnchor’sGestureDetectortobehavior: HitTestBehavior.translucentso empty regions still receive taps. - Add a widget test covering taps on a transparent region within the anchor’s bounds.
- Document the behavior change in
CHANGELOG.mdunder[Unreleased].
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/src/widgets/w_anchor.dart | Makes the anchor’s GestureDetector hit-test the full bounds via HitTestBehavior.translucent. |
| test/widgets/w_anchor_test.dart | Adds a regression test verifying taps on transparent/empty anchor regions trigger onTap. |
| CHANGELOG.md | Notes the WAnchor full-bounds hit-testing fix under [Unreleased]. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
CHANGELOG.md (1)
13-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove bold formatting to match surrounding tone.
The bold formatting (
**...**) at the beginning of this entry deviates from the surrounding tone. As per coding guidelines, changelog entries should match the surrounding tone, and other entries in this changelog do not use bold text for their opening statements.♻️ Proposed fix
-- **`WAnchor` now hit-tests its whole bounds via `HitTestBehavior.translucent`.** The inner `GestureDetector` used the default `HitTestBehavior.deferToChild`, so it only fired when a painted child sat under the exact tap point. An anchor wrapping transparent content (a settings row, a checkbox row, a link with padding) ignored taps that landed on its empty regions, including the element centre that automated drivers and centred pointer events target. It now behaves like `WInput`/`WPopover`, which already use whole-box hit-testing, so the full anchor rectangle is tappable. (`lib/src/widgets/w_anchor.dart`; covered by `test/widgets/w_anchor_test.dart`) +- `WAnchor` now hit-tests its whole bounds via `HitTestBehavior.translucent`. The inner `GestureDetector` used the default `HitTestBehavior.deferToChild`, so it only fired when a painted child sat under the exact tap point. An anchor wrapping transparent content (a settings row, a checkbox row, a link with padding) ignored taps that landed on its empty regions, including the element centre that automated drivers and centred pointer events target. It now behaves like `WInput`/`WPopover`, which already use whole-box hit-testing, so the full anchor rectangle is tappable. (`lib/src/widgets/w_anchor.dart`; covered by `test/widgets/w_anchor_test.dart`)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@CHANGELOG.md` at line 13, Remove the bold Markdown formatting from the opening WAnchor changelog entry while preserving its wording, inline code formatting, links, and surrounding changelog content.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@CHANGELOG.md`:
- Line 13: Remove the bold Markdown formatting from the opening WAnchor
changelog entry while preserving its wording, inline code formatting, links, and
surrounding changelog content.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 88d1fb05-eaaa-4eb7-b851-4e5f660d5f7e
📒 Files selected for processing (3)
CHANGELOG.mdlib/src/widgets/w_anchor.darttest/widgets/w_anchor_test.dart
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Every 1.2.0 entry opens in plain text; the Unreleased WAnchor entry used a bold lead-in that deviated from that tone. Flagged by CodeRabbit.
What
WAnchor's innerGestureDetectorused the defaultHitTestBehavior.deferToChild, so it only fired when a painted child sat under the exact tap point. Anchors wrapping transparent content (settings rows, checkbox rows, padded links) ignored taps on their empty regions, including the element centre that centred pointer events and automated drivers target.Fix
Set
HitTestBehavior.translucentso the whole anchor rectangle is tappable, matchingWInput/WPopoverwhich already use whole-box hit-testing. This also fixes real users tapping the blank part of a row.Notes
lib/src/widgets/w_anchor.dart; covered bytest/widgets/w_anchor_test.dart.[Unreleased].Summary by CodeRabbit
Bug Fixes
Documentation