Skip to content

fix(ios): accessibility path follows correct position in scroll view - #723

Open
eszlamczyk wants to merge 1 commit into
mainfrom
fix/696/accessibility-path-positions
Open

fix(ios): accessibility path follows correct position in scroll view#723
eszlamczyk wants to merge 1 commit into
mainfrom
fix/696/accessibility-path-positions

Conversation

@eszlamczyk

@eszlamczyk eszlamczyk commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

What/Why?

Fixes #696.

On iOS, VoiceOver drew the focus ring for EnrichedMarkdownText text at the wrong position (and failed to scroll to it) when the component was inside a ScrollView - e.g. a chat feed that appends messages.

Multi-line text ranges described their focus ring with an accessibilityPath in absolute screen coordinates, computed once and cached. Screen coordinates go stale the moment the ScrollView scrolls, so the ring pointed at the text's old position. This drops the screen-space path and describes every accessibility element with accessibilityFrameInContainerSpace, which UIKit re-projects to the screen on every query, so the geometry stays correct under scroll. (This matches the fix the reporter proposed.)

Note: because of this change we changed paragraphs to be one block instead of block per line.

Testing

  • Ran the example app's Text screen (EnrichedMarkdownText inside a ScrollView with long, multi-line content) on iOS. With VoiceOver / Accessibility Inspector, scrolled the content and navigated between paragraphs: the focus ring now sits on the visible text and VoiceOver scrolls each element into view. Verified single-line paragraphs, links, images, and headings still focus correctly.

Screenshots

Before
Screen.Recording.2026-08-28.at.11.21.32.mov
After
Screen.Recording.2026-08-28.at.11.17.19.mov

PR Checklist

  • Code compiles and runs on iOS
  • Code compiles and runs on Android
  • Updated documentation/README if applicable
  • Ran example app to verify changes
  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

Copilot AI lite review requested due to automatic review settings August 28, 2026 09:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes an iOS VoiceOver focus-ring positioning/scrolling bug for EnrichedMarkdownText when hosted inside a ScrollView, by avoiding stale screen-space geometry.

Changes:

  • Removes use of accessibilityPath (screen-coordinate, computed/cached) for multi-line text ranges.
  • Always sets accessibilityFrameInContainerSpace for each UIAccessibilityElement, allowing UIKit to project coordinates to screen space on demand (stays correct while scrolling).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

Incorrect accessibilityPath positions in ScrollView (iOS)

2 participants