Read the emoji of a field to a screen reader - #364
Open
rezabakhshilaktasaraei wants to merge 1 commit into
Open
Conversation
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.
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.
The emoji in the document of an
InputFieldare inline objects, one U+FFFC (object replacement character) each. Qt'sQAccessibleTextEditreturns 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
QAccessibleTextEditthat 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::WidgetsPrivateis already linked). Verified with NVDA on Windows.