Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS][A11Y] fix hittest with non-SemanticsObject #44014

Merged
merged 3 commits into from
Aug 2, 2023

Conversation

cyanglaz
Copy link
Contributor

@cyanglaz cyanglaz commented Jul 25, 2023

PlatformViewSemanticsContainer did not implement the nativeAccessibility method, leads to a nil object being returned.

Fixes flutter/flutter#131014

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

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

@@ -573,7 +578,13 @@ - (SemanticsObject*)search:(CGPoint)point {
// IOS 16. Overrides this method to focus the first eligiable semantics
// object in hit test order.
- (id)_accessibilityHitTest:(CGPoint)point withEvent:(UIEvent*)event {
return [self search:point];
id hittest = [self search:point];
if (hittest != self) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we just check if hittest is a semanticObject here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure. done

if (![hittest isKindOfClass:[SemanticsObject class]]) {
// If hittest result is not a SemanticsObject (e.g. PlatformView),
// call the default hittest method to find the hittest result inside the "hittest".
return [(NSObject*)hittest _accessibilityHitTest:point withEvent:event];
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not viable, unfortunately.

If we can't implement this method without needing to make a call like this, we'll need to remove the method entirely and find a different workaround for the initial problem it was added to address.

Chris Yang added 2 commits August 1, 2023 11:09
fix
cleanup

review

fix test
@cyanglaz
Copy link
Contributor Author

cyanglaz commented Aug 1, 2023

@stuartmorgan I overthought the problem. The fix is actually a lot simpler than what I had. PTAL

Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

Nice! LGTM

@cyanglaz cyanglaz added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 2, 2023
@auto-submit auto-submit bot merged commit 2e0bb5c into flutter:main Aug 2, 2023
26 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 2, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 2, 2023
@cyanglaz cyanglaz deleted the platform_view_npe branch August 2, 2023 18:02
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 2, 2023
…131790)

flutter/engine@d6b962d...9304c00

2023-08-02 skia-flutter-autoroll@skia.org Roll ANGLE from d29f946d6180 to 01ee134bb223 (1 revision) (flutter/engine#44269)
2023-08-02 ychris@google.com [iOS][A11Y] fix hittest with non-SemanticsObject (flutter/engine#44014)
2023-08-02 skia-flutter-autoroll@skia.org Roll ANGLE from d61a50c155bd to d29f946d6180 (1 revision) (flutter/engine#44267)
2023-08-02 skia-flutter-autoroll@skia.org Roll Skia from 6009cc6d7d80 to 514c66ce0471 (2 revisions) (flutter/engine#44268)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jacksongardner@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
cyanglaz pushed a commit to cyanglaz/engine that referenced this pull request Aug 3, 2023
PlatformViewSemanticsContainer did not implement the nativeAccessibility method, leads to a nil object being returned. 

Fixes flutter/flutter#131014

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
PlatformViewSemanticsContainer did not implement the nativeAccessibility method, leads to a nil object being returned. 

Fixes flutter/flutter#131014

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-ios
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iOS A11Y focus getting stuck for WebView
3 participants