Skip to content

Read the emoji of a field to a screen reader - #364

Open
rezabakhshilaktasaraei wants to merge 1 commit into
desktop-app:masterfrom
rezabakhshilaktasaraei:field-emoji-accessible-text
Open

Read the emoji of a field to a screen reader#364
rezabakhshilaktasaraei wants to merge 1 commit into
desktop-app:masterfrom
rezabakhshilaktasaraei:field-emoji-accessible-text

Conversation

@rezabakhshilaktasaraei

Copy link
Copy Markdown
Contributor

The emoji in the document of an InputField are inline objects, one U+FFFC (object replacement character) each. Qt's QAccessibleTextEdit returns the document text as is, so a screen reader reading the field got U+FFFC at an emoji and said nothing — the emoji could be copied (the text taken from the field resolves the objects), but was silent under the cursor and within a line.

Give the inner editor an accessible interface of its own from the factory: a subclass of Qt's QAccessibleTextEdit that substitutes the emoji's text (plain emoji from the image format, custom emoji from its stored text) for each U+FFFC in the text it returns. Offsets stay those of the document — one position per object — so the caret, the selection and the character rectangles are unchanged. Other objects (a collapsed quote) are left as they are.

Uses <private/qaccessiblewidgets_p.h> (Qt::WidgetsPrivate is already linked). Verified with NVDA on Windows.

The emoji in the document of a field are objects, a replacement
character each, and that is what a screen reader got reading the text:
an emoji typed or inserted into a field was silent under the cursor,
while it could be copied, as the text taken from the field resolves the
objects.

Give the inner editor an accessible interface of its own, from the
factory, that resolves them the same way for the text a screen reader
asks for - by document positions, one for every object, so the caret,
the selection and the character rectangles stay where they were.
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.

1 participant