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

Use accessibilityActivationPoint when determining where to tap elements. #1305

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

RoyalPineapple
Copy link
Contributor

@RoyalPineapple RoyalPineapple commented Sep 19, 2024

If a call to accessibilityActivate() returns false, VoiceOver (and related assistive technologies) will issue a tap event to the element as a secondary attempt to activate it via the the standard touch pipeline. The accessibilityActivationPoint can be set on elements to instruct assistive technologies where specifically on the screen to issue this tap event.

We should take this property into consideration when deciding the same. This is particularly important when the value is set deliberately. Failing to do so can cause taps to be issued that don't properly activate the element.

In the case where the property has not been explicitly set. The default value is the midpoint of the accessibility frame, which itself has a default value equivalent to self.frame this makes the change functionally equivalent to the following line which returns the midpoint of the frame.

Copy link
Contributor

@justinseanmartin justinseanmartin left a comment

Choose a reason for hiding this comment

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

To verify the behavior and prevent regressions, it would be nice to have a test where tapping on a control updates a label with what coordinates it was tapped at and then set a custom accessibility tap point on it.

@@ -931,6 +931,13 @@ - (CGPoint)tappablePointInRect:(CGRect)rect;
UIView *hitView = nil;
CGPoint tapPoint = CGPointZero;

// accessibilityActivationPoint
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to document here that it defaults to the center if no override is set.

@RoyalPineapple RoyalPineapple force-pushed the alex/TapAccessibilityActivationPoint branch 2 times, most recently from 1c865ef to 7457790 Compare September 24, 2024 19:12
@RoyalPineapple RoyalPineapple force-pushed the alex/TapAccessibilityActivationPoint branch from fe71ae1 to 72be8a5 Compare September 24, 2024 19:31
@RoyalPineapple RoyalPineapple merged commit 0213228 into master Sep 24, 2024
5 checks passed
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.

3 participants