Skip to content

[ios][platform_view]Reland hitTest approach (with a few 2026 update)#183484

Merged
auto-submit[bot] merged 6 commits into
flutter:masterfrom
hellohuanlin:pv_hit_test_2026
Apr 15, 2026
Merged

[ios][platform_view]Reland hitTest approach (with a few 2026 update)#183484
auto-submit[bot] merged 6 commits into
flutter:masterfrom
hellohuanlin:pv_hit_test_2026

Conversation

@hellohuanlin

@hellohuanlin hellohuanlin commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

This PR tries to re-land the original PR, which was reverted since we found a quick fix. However, hitTest is still important so we should land it. See (go/pv-touch-gesture-blocking-changes-2026 (internal golink)), or the public design doc.

For ease of review, I have split this PR into 2 commits: the 1st commit is the originally landed/reverted PR from last year; the 2nd commit is the changes in 2026 that we'd like to make. The changes are:

  1. Enable hitTest directly (regardless of policies)
  2. Rename hitTestOnly to doNotBlockGesture policy

If you have reviewed the original PR, feel free to only review the 2nd commit.

Next up: I will work on an integration test for drawing website fall-through issue, which will be fixed by this PR. The integration test likely be a 3rd commit in this PR, or a separate PR afterwards (depending on PR review timing)

List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.

Fixes #179916
Fixes #175099

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

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

@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems platform-ios iOS applications specifically framework flutter/packages/flutter repository. See also f: labels. engine flutter/engine related. See also e: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) platform-fuchsia Fuchsia code specifically f: gestures flutter/packages/flutter/gestures repository. platform-web Web applications specifically team-ios Owned by iOS platform team labels Mar 11, 2026
@hellohuanlin

hellohuanlin commented Mar 11, 2026

Copy link
Copy Markdown
Contributor Author

@loic-sharma @chunhtai

For ease of review, I have split this PR into 2 commits: the 1st commit is the original PR landed/reverted from last year; the 2nd commit is the changes in 2026 that we'd like to make. The changes are:

  • Enable hitTest directly (regardless of policies)
  • Rename hitTestOnly to doNotBlockGesture policy

Next up: I will work on an integration test for #179916, which will be fixed by this PR. The integration test likely be a 3rd commit in this PR, or a separate PR afterwards (depending on PR review timing). But anyways the 2nd commit of this PR should be ready for review. Or if you prefer, we can wait till integration test is in. No rush.

@hellohuanlin hellohuanlin marked this pull request as ready for review March 11, 2026 00:51
@hellohuanlin hellohuanlin requested a review from a team as a code owner March 11, 2026 00:51
Comment thread engine/src/flutter/lib/ui/hooks.dart Outdated
@@ -476,6 +477,24 @@ class RuntimeController : public PlatformConfigurationClient,
///
bool DispatchPointerDataPacket(const PointerDataPacket& packet);

// TODO(hellohuanlin): we should make make this a generic HitTest API.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same here - any concern of directly renaming it as HitTest for other platforms?

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request re-lands the hit-test approach for iOS platform views, with some updates. The changes are extensive, touching C++, Objective-C, and Dart code across the engine and framework. The core logic involves adding a hitTest mechanism that allows the framework to decide whether a platform view should receive a touch event. This is exposed through a new onHitTest callback on PlatformDispatcher. A new gesture blocking policy, doNotBlockGesture, is introduced to leverage this hit-testing mechanism. The changes are well-tested, with new unit tests covering the hit-testing logic and gesture policy behaviors. I have one suggestion to improve test code maintainability by refactoring duplicated logic into a helper function.

* https://github.com/flutter/flutter/issues/175099.
*/
FlutterPlatformViewGestureRecognizersBlockingPolicyTouchBlockingOnly,
FlutterPlatformViewGestureRecognizersBlockingPolicyDoNotBlockGesture,

@hellohuanlin hellohuanlin Mar 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm also open to these names:

  • NoGestureBlocking
  • NoUIGestureRecognizerBlocking
  • NoFlutterGestureArenaBlocking
  • Since the enum type name is already GestureRecognizersBlockingPolicy, I guess just NoBlocking or Disabled also works.

Comment thread packages/flutter/lib/src/services/platform_views.dart
Comment thread packages/flutter/lib/src/services/platform_views.dart Outdated
Comment thread engine/src/flutter/lib/ui/window/platform_configuration.cc Outdated
Comment thread engine/src/flutter/lib/ui/window/platform_configuration.h Outdated
Comment thread engine/src/flutter/lib/ui/window/platform_configuration.h Outdated
Comment thread engine/src/flutter/lib/ui/window/point_data.h
Comment thread engine/src/flutter/shell/common/shell.cc
Comment thread packages/flutter/lib/src/gestures/binding.dart Outdated
Comment thread packages/flutter/lib/src/services/platform_views.dart
Comment thread packages/flutter/lib/src/services/platform_views.dart Outdated
@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 14, 2026
@hellohuanlin hellohuanlin added the CICD Run CI/CD label Apr 14, 2026

@loic-sharma loic-sharma left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-LGTM for framework + engine. I only lightly reviewed iOS embedder changes.

@hellohuanlin hellohuanlin added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 15, 2026
@hellohuanlin

Copy link
Copy Markdown
Contributor Author

Thanks. The follow up commits are just fixing CI failures. We should be good.

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 15, 2026
@auto-submit

auto-submit Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/183484, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@hellohuanlin hellohuanlin added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 15, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Apr 15, 2026
Merged via the queue into flutter:master with commit 392bb79 Apr 15, 2026
204 of 205 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 15, 2026
master-wayne7 pushed a commit to master-wayne7/flutter that referenced this pull request Apr 15, 2026
…lutter#183484)

This PR tries to re-land [the original
PR](flutter#179659), which was reverted
since we found a quick fix. However, hitTest is still important so we
should land it. See ([go/pv-touch-gesture-blocking-changes-2026
(internal
golink)](http://goto.google.com/pv-touch-gesture-blocking-changes-2026)),
or the [public design
doc](https://goto.google.com/ios-platform-view-touch-gesture-blocking).

For ease of review, I have split this PR into 2 commits: the 1st commit
is the [originally landed/reverted PR from last
year](flutter#179659); the 2nd commit is
the changes in 2026 that we'd like to make. The changes are:

1. Enable hitTest directly (regardless of policies)
2. Rename `hitTestOnly` to `doNotBlockGesture` policy

If you have reviewed the original PR, feel free to only review the 2nd
commit.

Next up: I will work on an integration test for [drawing website
fall-through issue](flutter#179916),
which will be fixed by this PR. The integration test likely be a 3rd
commit in this PR, or a separate PR afterwards (depending on PR review
timing)

*List which issues are fixed by this PR. You must list at least one
issue. An issue is not required if the PR fixes something trivial like a
typo.*

Fixes flutter#179916
Fixes flutter#175099


*If you had to change anything in the [flutter/tests] repo, include a
link to the migration guide as per the [breaking change policy].*

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

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](https://developers.google.com/gemini-code-assist/docs/review-github-code).
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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
@vashworth vashworth added the revert Autorevert PR (with "Reason for revert:" comment) label Apr 15, 2026
@auto-submit

auto-submit Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

A reason for requesting a revert of flutter/flutter/183484 could
not be found or the reason was not properly formatted. Begin a comment with 'Reason for revert:' to tell the bot why
this issue is being reverted.

@vashworth

Copy link
Copy Markdown
Contributor

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

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: text input Entering text in a text field or keyboard related problems CICD Run CI/CD engine flutter/engine related. See also e: labels. f: gestures flutter/packages/flutter/gestures repository. framework flutter/packages/flutter repository. See also f: labels. platform-fuchsia Fuchsia code specifically platform-ios iOS applications specifically platform-web Web applications specifically revert_wf Revert using Github Workflow team-ios Owned by iOS platform team

Projects

None yet

4 participants