Skip to content

fix(anchor): make the whole WAnchor bounds tappable via translucent hit-test#152

Open
anilcancakir wants to merge 4 commits into
masterfrom
fix/anchor-translucent-hit-test
Open

fix(anchor): make the whole WAnchor bounds tappable via translucent hit-test#152
anilcancakir wants to merge 4 commits into
masterfrom
fix/anchor-translucent-hit-test

Conversation

@anilcancakir

@anilcancakir anilcancakir commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

What

WAnchor's inner GestureDetector used the default HitTestBehavior.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.translucent so the whole anchor rectangle is tappable, matching WInput/WPopover which already use whole-box hit-testing. This also fixes real users tapping the blank part of a row.

Notes

  • Single file: lib/src/widgets/w_anchor.dart; covered by test/widgets/w_anchor_test.dart.
  • CHANGELOG updated under [Unreleased].
  • Surfaced while driving a Wind app via fluttersdk_dusk (transparent rows silently ignored centre taps).

Summary by CodeRabbit

  • Bug Fixes

    • Improved anchor tap detection so the entire anchor area responds to taps, including transparent or empty regions.
    • Added coverage to ensure taps outside visible child content trigger the anchor action.
  • Documentation

    • Updated the changelog with details of the anchor interaction fix.

…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.
Copilot AI review requested due to automatic review settings July 17, 2026 23:19
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@anilcancakir, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c6919975-7782-4c0a-a04b-50ff1d0db055

📥 Commits

Reviewing files that changed from the base of the PR and between 2e59167 and 80cfc5f.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • test/widgets/w_anchor_test.dart
📝 Walkthrough

Walkthrough

WAnchor now hit-tests its entire bounds for gestures, including transparent or empty regions. A widget test verifies taps outside painted child content trigger onTap, and the changelog documents the fix.

Changes

WAnchor hit testing

Layer / File(s) Summary
Full-bounds gesture detection
lib/src/widgets/w_anchor.dart, test/widgets/w_anchor_test.dart, CHANGELOG.md
GestureDetector uses HitTestBehavior.translucent; an interaction test covers transparent anchor areas, and the changelog records the behavior change.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: making WAnchor fully tappable with a translucent hit test.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/anchor-translucent-hit-test

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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’s GestureDetector to behavior: HitTestBehavior.translucent so 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.md under [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].

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
CHANGELOG.md (1)

13-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4f63db6 and 2e59167.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • lib/src/widgets/w_anchor.dart
  • test/widgets/w_anchor_test.dart

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

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.
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.

2 participants