Skip to content

[two_dimensional_scrollables] Fix horizontal scrolled tree view hit testing#10976

Closed
MousyBusiness wants to merge 3 commits intoflutter:mainfrom
MousyBusiness:main
Closed

[two_dimensional_scrollables] Fix horizontal scrolled tree view hit testing#10976
MousyBusiness wants to merge 3 commits intoflutter:mainfrom
MousyBusiness:main

Conversation

@MousyBusiness
Copy link

@MousyBusiness MousyBusiness commented Feb 7, 2026

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

List which issues are fixed by this PR. You must list at least one issue.

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

@MousyBusiness MousyBusiness requested a review from Piinks as a code owner February 7, 2026 22:18
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions bot added p: two_dimensional_scrollables Issues pertaining to the two_dimensional_scrollables package triage-framework Should be looked at in framework triage labels Feb 7, 2026
@google-cla
Copy link

google-cla bot commented Feb 7, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a hit-testing bug in the TreeView widget that occurred when the content was horizontally scrolled. The fix involves changing how the hit-test rectangle for each row is calculated in RenderTreeViewport. Instead of using the viewport's width, it now correctly uses the row's actual width. This ensures that the entire row is interactive, even the parts that are scrolled into view horizontally. The PR also includes the corresponding version bump and an entry in the CHANGELOG.md. The changes are correct, but a test case to cover this fix would be a valuable addition.

Comment on lines 163 to +165
final Rect rowRect =
parentData.paintOffset! &
Size(viewportDimension.width, row.size.height);
Size(row.size.width, row.size.height);

Choose a reason for hiding this comment

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

medium

This change correctly fixes the hit testing issue for horizontally scrolled content. However, there doesn't appear to be a new test case that covers this specific scenario. To prevent regressions, it would be beneficial to add a test that:

  1. Creates a TreeView with a row wider than the viewport.
  2. Scrolls horizontally to reveal the overflowed part of the row.
  3. Taps on the overflowed part and asserts that the tap is correctly handled.

This would ensure the fix is working as expected and remains stable in the future.

References
  1. The repository style guide states that code changes should have appropriate tests. (link)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p: two_dimensional_scrollables Issues pertaining to the two_dimensional_scrollables package triage-framework Should be looked at in framework triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant