Skip to content

refactor(ios): simplify accessibility text element creation#188

Merged
hryhoriiK97 merged 2 commits intomainfrom
@hryhoriiK97/fix/simplify-accessibility-text-elements
Mar 27, 2026
Merged

refactor(ios): simplify accessibility text element creation#188
hryhoriiK97 merged 2 commits intomainfrom
@hryhoriiK97/fix/simplify-accessibility-text-elements

Conversation

@hryhoriiK97
Copy link
Copy Markdown
Collaborator

@hryhoriiK97 hryhoriiK97 commented Mar 27, 2026

What/Why?

Simplifies how VoiceOver text elements are created in MarkdownAccessibilityElementBuilder.

Previously, each paragraph was split into separate accessibility elements per visual line using NSLayoutManager line fragment enumeration. This caused VoiceOver to announce text line-by-line instead of as coherent paragraphs.

Now paragraphs without inline links produce a single accessibility element. Paragraphs with links are still segmented into text and link parts, but whitespace-only segments are filtered out to avoid empty announcements.

Known issue: Blockquote background/border doesn't wrap correctly when the text contains inline links — the border breaks at link boundaries instead of spanning the full line. This is a cosmetic issue caused by NSAttributedString drawing separate background rects per attribute run, and will be addressed in a future PR.

Fixes: #181

Testing

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

@hryhoriiK97 hryhoriiK97 merged commit 255a214 into main Mar 27, 2026
5 checks passed
@malopezr7
Copy link
Copy Markdown

@hryhoriiK97 Nice, that's a clean approach! Collapsing the line fragment enumeration into a single element for link-free paragraphs is exactly the right first step — and filtering whitespace-only segments is a good detail I missed.

Glad to see the Android side is coming too. Happy to help test once it lands — we're exercising this pretty heavily in our chat support bot with mixed content (lists, code blocks, inline links).

I'll close my #186 since #188 covers the core fix. Let me know if there's anything I can help with on the remaining pieces.

@hryhoriiK97 hryhoriiK97 deleted the @hryhoriiK97/fix/simplify-accessibility-text-elements branch March 28, 2026 18:29
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.

[iOS] VoiceOver navigates rendered markdown by visual fragments instead of semantic blocks

2 participants