chatdlg: replace QTextBrowser with QListView for screen reader accessibility#3750
Open
mcfnord wants to merge 1 commit into
Open
chatdlg: replace QTextBrowser with QListView for screen reader accessibility#3750mcfnord wants to merge 1 commit into
mcfnord wants to merge 1 commit into
Conversation
…ibility Replaces QTextBrowser with QListView + QStyledItemDelegate in the chat dialog so that each message is a discrete item in the OS accessibility tree. With QTextBrowser, VoiceOver (and other screen readers) sees the entire chat history as one opaque text block. With QListView, each appended message becomes a QAccessible::ListItem, letting the user arrow-key through individual messages. ChatDelegate renders each item as HTML via QTextDocument, preserving existing rich-text formatting. Link clicks are detected in eventFilter via QTextDocument::documentLayout()->anchorAt(). Hovering over a link shows a pointing-hand cursor. Clicking routes through the existing OnAnchorClicked confirmation dialog. Right-click or Ctrl+C copies the selected message's plain text to the clipboard. Accessibility fixes for macOS VoiceOver: - Qt::AccessibleTextRole is set to the HTML-stripped plain text on each item. VoiceOver reads this role when narrating a list item; without it, it reads the raw HTML markup verbatim and produces silence or garbled output. - QAccessibleTableModelChangeEvent::RowsInserted fires after each append so the AT stack knows a new row exists, followed by QAccessibleValueChangeEvent carrying the plain text — the correct signal sequence for live-region-style auto-announcement of incoming messages. Fixes jamulussoftware#3613. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
Someone please try this on a Mac using VoiceOver. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces
QTextBrowserwithQListView+QStyledItemDelegatein the chat dialog so that each message is a discrete item in the OS accessibility tree.With
QTextBrowser, VoiceOver (and other screen readers that consumeQAccessible) sees the entire chat history as a single text block. WithQListView, each appended message becomes aQAccessible::ListItem, letting the user arrow-key through individual messages.ChatDelegaterenders each item as HTML viaQTextDocument, preserving the existing rich-text formatting. Link clicks are detected ineventFilterby installing a filter on the viewport and usingQTextDocument::documentLayout()->anchorAt()to hit-test the click position. Hovering over a link shows a pointing-hand cursor. Clicking routes through the existingOnAnchorClickedconfirmation dialog. Right-click or Ctrl+C copies the selected message's plain text to the clipboard.macOS VoiceOver fixes (addresses the silence reported in testing)
Two issues prevented VoiceOver from speaking on macOS:
Qt::AccessibleTextRole—Qt::DisplayRolestores raw HTML. VoiceOver reads this role verbatim and sees angle-bracket markup, producing silence or garbled output. Fix:QTextDocument::toPlainText()strips the tags, and the result is stored asQt::AccessibleTextRoleon each item — the role VoiceOver actually queries for the item's accessible name.Correct accessibility events — Replaced the previous
QAccessibleValueChangeEvent(which fired before HTML processing and before the row existed) withQAccessibleTableModelChangeEvent::RowsInsertedtargeting the exact new row, followed byQAccessibleValueChangeEventcarrying the plain text. This is the correct signal sequence for live-region-style auto-announcement of incoming messages on macOS.Fixes an issue?
Addresses #3613.
Does this change need documentation?
No documentation changes needed.
Status
Builds and runs. VoiceOver on macOS should now speak individual messages when navigating the list and announce incoming messages automatically. Please test with VoiceOver — specifically: does arrowing to a message read it aloud, and does an incoming message get announced without user action?
Checklist