IA2TextTextInfo: Fix handling of embedded objects when expanding to mouse chunk.#14755
Merged
Conversation
seanbudd
approved these changes
Mar 29, 2023
5 tasks
michaelDCurran
pushed a commit
that referenced
this pull request
Jul 28, 2024
…sting for embedded objects during mouse navigation. (#16912) In Firefox, when a paragraph, line, etc. contains links (or other elements), moving the mouse over text before or after the link sometimes doesn't report the text correctly. I attempted to fix this in #14755, and while my fix did work in some cases, it seems it wasn't quite complete. Description of user facing changes In Mozilla Firefox, moving the mouse over text before or after a link now reliably reports the text. Description of development approach To search for embedded objects, IA2TextTextInfo.expand fetches the text between the expanded start and end offsets. Previously, when adjusting the offsets if an embedded object was found, the code didn't add the offset from the start of the object to the start of the retrieved text. Now it does.
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.
Link to issue number:
Fixes #9235.
Summary of the issue:
In Firefox, when there is text before and after a link, mousing over the text after the link often doesn't read the text. This applies to other types of inline elements as well; e.g. buttons.
Description of user facing changes
In Mozilla Firefox, moving the mouse over text after a link, etc. now reliably reports the text.
Description of development approach
When handling unit_mouseChunk, the code in IA2TextTextInfo.expand first expands to the user configured resolution (line, paragraph, etc.). It then attempts to shrink the range so that it only covers the text between embedded objects before and after the origin, if any.
The code previously calculated the final end offset incorrectly. It used
oldEnd - self._startOffsetas the offset from which to search for an embedded object after the origin. However, self._startOffset had already been moved to the embedded object before the origin, so it was no longer related to the text string. This meant that the search offset was completely bogus and could even result in_endOffsetbeing smaller than_startOffset.Now, we use the same offset for both embedded object searches: our origin relative to the start of the expanded range of text. I've also added comments.
Testing strategy:
Opened this test case in Firefox:
data:text/html,a b c <button>d</button> e f g<br>hMoused over a, d and h.
Before this change, NVDA reported "a b c", "d" and "h", but would not report "e f g".
Now, it does.
Opened this page in Firefox: https://github.blog/2023-03-09-how-github-accelerates-development-for-embedded-systems/
Known issues with pull request:
None.
Change log entries:
Bug fixes
In Mozilla Firefox, moving the mouse over text after a link, etc. now reliably reports the text.
Code Review Checklist: