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

[a11y] fixes overlayPortals not showing VoiceControl labels #164754

Merged
merged 12 commits into from
Mar 12, 2025

Conversation

LouiseHsu
Copy link
Contributor

@LouiseHsu LouiseHsu commented Mar 7, 2025

Fixes #157753
Even when a uiaccessibilityelement is marked as accessibilityRespondsToUserInteraction, if it's spatially far away enough from its parent's accessibilityFrame, a VoiceControl label will not be created for it. In this PR, I set the parent SemanticObjectContainer's accessibilityFrame so it is the minimum rect that will cover all it's children.

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], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions bot added platform-ios iOS applications specifically engine flutter/engine repository. See also e: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) team-ios Owned by iOS platform team labels Mar 7, 2025
@github-actions github-actions bot removed the a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) label Mar 8, 2025
@LouiseHsu LouiseHsu marked this pull request as ready for review March 10, 2025 21:06
@LouiseHsu LouiseHsu changed the title Overlay portal bug [a11y] fixes overlayPortals not showing VoiceControl labels Mar 10, 2025
@@ -790,7 +790,6 @@ - (BOOL)accessibilityRespondsToUserInteraction {
if (!self.node.customAccessibilityActions.empty()) {
return true;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the formatter did this

// Find the min rect containing the children, and set the accessibilityFrame to that.
NSArray<SemanticsObject*>* children = self.semanticsObject.children;
CGRect boundingRect = self.semanticsObject.accessibilityFrame;
for (SemanticsObject* child in children) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We may need to be careful about performance since a11yframe is called quite frequently. If we want to traverse the subtree we should have some sort of caching.

I remembered there was an idea to make this frame to always cover the screen. Is that still on the table?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I can also just make it always cover the screen. Im just not well versed about performance implications when it comes to a11y.

Copy link
Contributor

@chunhtai chunhtai Mar 10, 2025

Choose a reason for hiding this comment

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

I can say from experience this may be called multiple times on multiple UIAccessibility[s] in a single left or right swipe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I encountered some weirdness because i was using UIScreen.mainScreen and someone mentioned it might act weird if theres a second screen, but I can revert to that approach too.

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if you can use FlutterView's bound instead. but someone from iOS team should be able to confirm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i ended up using UIScreen.mainScreen after asking around. looks like the way we refer to screen bounds in most of the code base.

@LouiseHsu LouiseHsu requested a review from chunhtai March 11, 2025 21:40
Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM

@LouiseHsu LouiseHsu added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 12, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Mar 12, 2025
Merged via the queue into flutter:master with commit 895cab5 Mar 12, 2025
170 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine flutter/engine repository. See also e: labels. platform-ios iOS applications specifically team-ios Owned by iOS platform team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS][a11y] Widgets inside OverlayPortal don't display iOS number labels for VoiceControl
2 participants