Skip to content

Use accessibilityActivationPoint when determining where to tap elements.#1305

Merged
RoyalPineapple merged 1 commit into
masterfrom
alex/TapAccessibilityActivationPoint
Sep 24, 2024
Merged

Use accessibilityActivationPoint when determining where to tap elements.#1305
RoyalPineapple merged 1 commit into
masterfrom
alex/TapAccessibilityActivationPoint

Conversation

@RoyalPineapple

@RoyalPineapple RoyalPineapple commented Sep 19, 2024

Copy link
Copy Markdown
Contributor

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.

@justinseanmartin justinseanmartin 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.

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.

UIView *hitView = nil;
CGPoint tapPoint = CGPointZero;

// accessibilityActivationPoint

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.

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
amorde pushed a commit to amorde/KIF that referenced this pull request Jun 26, 2025
amorde pushed a commit to amorde/KIF that referenced this pull request Feb 24, 2026
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