Skip to content

If the text of a control is not navigable, use NVDAObjectTextInfo for object review and read line.#18271

Merged
seanbudd merged 5 commits into
nvaccess:masterfrom
jcsteh:onlyUseIa2Editable
Jun 24, 2025
Merged

If the text of a control is not navigable, use NVDAObjectTextInfo for object review and read line.#18271
seanbudd merged 5 commits into
nvaccess:masterfrom
jcsteh:onlyUseIa2Editable

Conversation

@jcsteh

@jcsteh jcsteh commented Jun 17, 2025

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #15159. Fixes #11285.

Summary of the issue:

In focus mode in web browsers, when a control specifies a label using aria-label or aria-labelledby, it is impossible to review or spell that label; e.g. using read current line or the review cursor. This is particularly annoying and detrimental to efficiency when using web apps such as Gmail and Slack, among others, where you have to switch to browse mode to work around this even though it might be more efficient to use focus mode for navigation.

The same bug also applies in Google Chrome menus and dialogs where UIA is not used, such as in Chrome 137.

Description of user facing changes:

In focus mode in web browsers, it is now possible to review and spell the labels of controls when those labels are specifically provided for accessibility; e.g. via aria-label or aria-labelledby.

Description of development approach:

When in focus mode, for non-editable controls, both speech and braille report the name, description, value, etc. of the control; they don't use the TextInfo. However, previously, the review cursor and the read line command always used the TextInfo. Since IA2TextTextInfo is used for all objects supporting IAccessibleText, this meant that if the content wasn't a flat piece of text equal to the label, the review cursor and read line command would report something different, often nothing at all. To fix this, use NVDAObjectTextInfo instead of the object's TextInfo for object review and the read line command.

Testing strategy:

In both Firefox and Edge:

  1. Followed and verified the steps to reproduce in Can't review/spell text of accessible names applied with aria-label/labelledby in focus mode #15159 (comment).
  2. Also tested with the review cursor in the Gmail message list, where previously, the review cursor couldn't read the message details. With this change, it can. Same for read current line.
  3. Verified that braille remains the same as before (the expected behaviour) in all of these scenarios.
  4. Also tested this test case:
    data:text/html,<textarea>ab
    Verified that in focus mode, formatting info is still reported for the review cursor, indicating that the correct TextInfo is being used. Also verified that the review cursor tracks the caret.
  5. With a multi line message in Gmail, verified that read current line reports the correct line when on the second or subsequent lines.
  6. I wasn't able to reproduce NVDA+Up fails to read or spell many controls and lines in Google Chrome #11285 myself. However, @amirsol81 verified that this change fixes that too.

Known issues with pull request:

Although this fix is primarily about focus mode in web browsers, the code paths it touches are more generic than that. Anything that has a specific TextInfo but for which _hasNavigableText returns False will be impacted. This is consistent with how we report the focus with speech and what is shown in braille, and thus I think this makes sense. Nevertheless, this potential broader impact is worth noting.

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.

@coderabbitai summary

@jcsteh jcsteh requested a review from a team as a code owner June 17, 2025 11:48
@jcsteh jcsteh requested a review from seanbudd June 17, 2025 11:48
@jcsteh jcsteh marked this pull request as draft June 17, 2025 12:21
@jcsteh

jcsteh commented Jun 17, 2025

Copy link
Copy Markdown
Contributor Author

Converting to draft until I figure out the Chrome system test failures.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit b619456c05

@cary-rowen

Copy link
Copy Markdown
Contributor

Just a reminder: if this works as expected #17573, #16248 can be revert.

@jcsteh

jcsteh commented Jun 18, 2025

Copy link
Copy Markdown
Contributor Author

Unfortunately, I have to go back to square 0 on this. It breaks reporting of annotation details. I have some thoughts on another solution using _hasNavigableText, but I think it's going to be a bit more complicated than this current patch.

@brunoprietog

brunoprietog commented Jun 18, 2025

Copy link
Copy Markdown

It looks like something like this was done in the VS Code module to fix the same problem. Now that this would be completely fixed, maybe that custom code could be removed?

Edit: Sorry, I just saw the comment above!

@jcsteh jcsteh force-pushed the onlyUseIa2Editable branch from c87d030 to b1cd303 Compare June 19, 2025 04:58
@jcsteh jcsteh changed the title Only use IA2 TextInfo for editable text controls. If the text of a control is not navigable, use NVDAObjectTextInfo for object review. Jun 19, 2025
@jcsteh jcsteh force-pushed the onlyUseIa2Editable branch from b1cd303 to a9e5bfb Compare June 19, 2025 05:12
@jcsteh jcsteh changed the title If the text of a control is not navigable, use NVDAObjectTextInfo for object review. If the text of a control is not navigable, use NVDAObjectTextInfo for object review and read line. Jun 19, 2025
@jcsteh jcsteh marked this pull request as ready for review June 19, 2025 22:42
Comment thread user_docs/en/changes.md Outdated
Comment thread source/review.py Outdated
Comment thread source/review.py
@CyrilleB79

Copy link
Copy Markdown
Contributor

Does it fix #11285?

If yes, or maybe in any case, it should rather land in the bugfix section of the change log, shouldn't it?

@jcsteh

jcsteh commented Jun 23, 2025

Copy link
Copy Markdown
Contributor Author

I can't reproduce #11285 even with NVDA alpha.

jcsteh and others added 2 commits June 23, 2025 19:21
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
@jcsteh

jcsteh commented Jun 24, 2025

Copy link
Copy Markdown
Contributor Author

I'm not willing to take on the reverts of the Visual Studio Code changes, as I don't use Visual Studio Code here and thus can't test whether this more generic fix actually addresses those issues correctly. However, someone else is very welcome to pursue that if/when this PR gets merged.

Comment thread source/review.py Outdated
Comment thread source/review.py Outdated
Comment thread source/review.py Outdated
Comment thread source/review.py Outdated
@seanbudd

Copy link
Copy Markdown
Member

Thanks @jcsteh

@seanbudd seanbudd merged commit 7776fc0 into nvaccess:master Jun 24, 2025
4 of 5 checks passed
@github-actions github-actions Bot added this to the 2025.2 milestone Jun 24, 2025
@cary-rowen

Copy link
Copy Markdown
Contributor

Hi @jcsteh
I'll investigate the situation with Visual Studio code and make further adjustments, such as rolling back a specific fix before.

@jcsteh jcsteh deleted the onlyUseIa2Editable branch June 24, 2025 05:45
cary-rowen added a commit to cary-rowen/nvda that referenced this pull request Jun 24, 2025
seanbudd pushed a commit that referenced this pull request Jun 25, 2025
Reverts PR

Reverts #17573, #16248
Issues fixed

n/a
Issues reopened

n/a
Reason for revert

#18271 is a more general implementation, fixed from the root #16246.
seanbudd pushed a commit that referenced this pull request Jul 4, 2025
Fixes #18399
Fixup regression caused by #18271
Summary of the issue:

Since #18271, object navigation might cause errors with braille in XAML static text controls.
Description of user facing changes:

No errors, working braille.
Description of developer facing changes:

N/a
Description of development approach:

Be more conservative in applying an EditableText overlay class to UIA objects. Before this change, objects only needed to have UIATextInfo, implicitly meaning that it ought to have a text pattern. With this, we only add EditableText if either:
a. The object has navigable text; or
b. The objects text pattern reports that selection is supported.
jcsteh added a commit to jcsteh/nvda that referenced this pull request Jul 21, 2025
…Info for object review and read line. (nvaccess#18271)"

This reverts commit 7776fc0.
jcsteh added a commit to jcsteh/nvda that referenced this pull request Jul 21, 2025
…Info for object review and read line. (nvaccess#18271)"

This reverts commit 7776fc0.
SaschaCowley pushed a commit that referenced this pull request Jul 21, 2025
Reverts PR
Reverts #18271 and #18318.

Issues fixed
Fixes #18498.

Issues reopened
Reopens #15159. Reopens #11285.

Reason for revert
Causes regression #18498.

Can this PR be reimplemented? If so, what is required for the next attempt
Unknown.
seanbudd pushed a commit that referenced this pull request May 11, 2026
…#20096)

Fixes #15159.
Summary of the issue:

In focus mode in web browsers, when a control specifies a label using aria-label or aria-labelledby, it is impossible to review or spell that label; e.g. using read current line or the review cursor. This is particularly annoying and detrimental to efficiency when using web apps such as Gmail and Slack, among others, where you have to switch to browse mode to work around this even though it might be more efficient to use focus mode for navigation.
Description of user facing changes:

In focus mode in web browsers, it is now possible to review and spell the labels of controls when those labels are specifically provided for accessibility; e.g. via aria-label or aria-labelledby.
Description of development approach:

When in focus mode, for non-editable controls, both speech and braille report the name, description, value, etc. of the control; they don't use the TextInfo. However, previously, the review cursor and the read line command always used the TextInfo. Since IA2TextTextInfo is used for all objects supporting IAccessibleText, this meant that if the content wasn't a flat piece of text equal to the label, the review cursor and read line command would report something different, often nothing at all.

To fix this, for IA2Web objects that aren't editors, use NVDAObjectTextInfo instead of the object's TextInfo for object review and the read line command. I first attempted to do this generically in #18271 using _hasNavigableText, but this caused problems elsewhere. Instead, the scope of this change is very specific, introducing a new _shouldUseTextInfoForReview NVDAObject attribute which is only set to False for Ia2Web objects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

6 participants