Skip to content

IA2TextTextInfo: Fix handling of embedded objects when expanding to mouse chunk.#14755

Merged
seanbudd merged 3 commits into
nvaccess:masterfrom
jcsteh:ia2Mouse
Mar 29, 2023
Merged

IA2TextTextInfo: Fix handling of embedded objects when expanding to mouse chunk.#14755
seanbudd merged 3 commits into
nvaccess:masterfrom
jcsteh:ia2Mouse

Conversation

@jcsteh

@jcsteh jcsteh commented Mar 28, 2023

Copy link
Copy Markdown
Contributor

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._startOffset as 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 _endOffset being 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>h
Moused 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/

  1. NVDA+control+f, enter: We know that DevOps
  2. Route the mouse to the text. NVDA reports correctly both before and after this change.
  3. Press k to move to the "ISO 26262" link.
  4. Use the cursor keys to move right out of the link.
  5. Route the mouse. NVDA reports nothing before this change, but correctly reports "for automotive," with this change.
  6. Press k to move to the "IEC 62304" link.
  7. Use the cursor keys to move right out of the link.
  8. Route the mouse. NVDA reports nothing before this change, but correctly reports "for medical devices," etc. with this change.

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:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • Security precautions taken.

@jcsteh jcsteh requested a review from a team as a code owner March 28, 2023 06:18
@jcsteh jcsteh requested a review from seanbudd March 28, 2023 06:18
@seanbudd seanbudd merged commit bc3e97d into nvaccess:master Mar 29, 2023
@nvaccessAuto nvaccessAuto added this to the 2023.2 milestone Mar 29, 2023
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.
@jcsteh jcsteh deleted the ia2Mouse branch May 25, 2026 04:01
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.

Firefox: can't read text right after inline element using the mouse

3 participants