Skip to content

fix missing highlighter on OCR recognition results#19168

Merged
SaschaCowley merged 14 commits into
nvaccess:masterfrom
hwf1324:RecogResultHighlighter
Nov 14, 2025
Merged

fix missing highlighter on OCR recognition results#19168
SaschaCowley merged 14 commits into
nvaccess:masterfrom
hwf1324:RecogResultHighlighter

Conversation

@hwf1324

@hwf1324 hwf1324 commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

Link to issue number:

Summary of the issue:

There is no highlighter on the recognition result.

Description of user facing changes:

There is a highlighter on the recognition result.

Description of developer facing changes:

Added api.fakeNVDAObjectClasses set and api.isFakeNVDAObject function to identify fake NVDAObject instances.

Description of development approach:

Do not use the display model to obtain the caret rectangle of fake NVDAObjects.

Testing strategy:

Manual testing: After pressing NVDA+r to recognize content, move the cursor and observe whether the yellow rectangle follows.

Known issues with pull request:

By default, the highlight rectangle currently covers words rather than individual characters.

Code Review Checklist:

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

This change ensures that
`RecogResultNVDAObject` instances are properly ignored when calculating
caret rectangles, allowing highlighters to display correctly.

Fixes an issue where visual enhancements were not applied to content
recognition results.
@hwf1324 hwf1324 requested a review from a team as a code owner November 5, 2025 04:22
@hwf1324 hwf1324 requested a review from SaschaCowley November 5, 2025 04:22
Comment thread source/vision/util.py Outdated
Comment thread user_docs/en/changes.md Outdated
Co-authored-by: Cyrille Bougot <cyrille.bougot2@laposte.net>
@hwf1324 hwf1324 marked this pull request as draft November 5, 2025 09:54
- Added `api.fakeNVDAObject` set and `api.isFakeNVDAObject` function to identify fake NVDAObject instances.
- Registered `RecogResultNVDAObject` as a fake NVDAObject in recogUi module.
@hwf1324 hwf1324 marked this pull request as ready for review November 6, 2025 03:08
@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Nov 11, 2025
Comment thread source/api.py Outdated
Comment thread source/api.py Outdated
Comment thread user_docs/en/changes.md Outdated
hwf1324 and others added 3 commits November 11, 2025 13:57
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
@seanbudd seanbudd changed the title fix(vision): resolve missing highlighters on recognition results fix missing highlighter on OCR recognition results Nov 11, 2025
…ct classes

Updated the type annotation for `fakeNVDAObjectClasses` to be more specific,
indicating it holds types of `documentBase.TextContainerObject`. Also added
documentation explaining that these classes represent virtual NVDAObjects.
@hwf1324

hwf1324 commented Nov 11, 2025

Copy link
Copy Markdown
Contributor Author

I added a docstring for api.fakeNVDAObjectClasses, but I'm not sure if it's clear?

Comment thread source/api.py Outdated
Comment thread source/api.py Outdated
Comment thread user_docs/en/changes.md
Comment thread user_docs/en/changes.md
hwf1324 and others added 4 commits November 14, 2025 08:24
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>

@SaschaCowley SaschaCowley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @hwf1324

@SaschaCowley SaschaCowley enabled auto-merge (squash) November 14, 2025 05:00
@SaschaCowley SaschaCowley merged commit e0906cf into nvaccess:master Nov 14, 2025
29 checks passed
@github-actions github-actions Bot added this to the 2026.1 milestone Nov 14, 2025
@hwf1324 hwf1324 deleted the RecogResultHighlighter branch November 14, 2025 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants