Skip to content

Fix empty edit fields not speaking in Microsoft Edge#12475

Merged
michaelDCurran merged 5 commits into
nvaccess:betafrom
LeonarddeR:edgeEditFix
May 31, 2021
Merged

Fix empty edit fields not speaking in Microsoft Edge#12475
michaelDCurran merged 5 commits into
nvaccess:betafrom
LeonarddeR:edgeEditFix

Conversation

@LeonarddeR

@LeonarddeR LeonarddeR commented May 28, 2021

Copy link
Copy Markdown
Collaborator

Link to issue number:

Fixes #12474
Fixes #12189

Summary of the issue:

Empty edit fields aren't spoken in Edge. There's a bug in the UIA implementation that causes expand to line to fail when there is no text content in the object

Description of how this pull request fixes the issue:

  1. Use the ChromiumUIA object overlay for text boxes in the Chrome/Edge interface. For Edge, this applies by default. For Chrome, this only applies to cases where experimental UIA support is enabled, but this is far from stable in Chrome itself.
  2. On the ChromeUIATextInfo when expanding to line, check whether there's any text in the document range. If not, don't try to expand as it will break the range.
  3. Make sure not to cache the TextInfo property on UIA objects.ChromiumUIATextInfo. This is necessary because the property is fetched before the overlay classes are added that might change the result of evaluating the property. This ensures the proper TextInfo is used on focus.

Testing strategy:

Tested that the address bar of Edge is read correctly when empty and focused.

Known issues with pull request:

None known.

Change log entries:

Bug fixes

Code Review Checklist:

  • Pull Request description is up to date.
  • Unit tests.
  • System (end to end) tests.
  • Manual testing.
  • User Documentation.
  • Change log entry.
  • Context sensitive help for GUI changes.
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

I actually think that this pr will mean a significant improvement for Edge users, therefore I'd like to request to have this merged into beta instead.

@cary-rowen

Copy link
Copy Markdown
Contributor

This is a significant improvement and hope to be merged into Beta

@alexarnaud

Copy link
Copy Markdown

Thanks a lot @LeonarddeR for fixing this.

I have two questions :

  • Do you still reproduce with Edge version 91 released today?
  • Is it possible for you to report the UIA issue against Edge?

Best regards.

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

@alexarnaud wrote:

I have two questions :

  • Do you still reproduce with Edge version 91 released today?

Yes.

  • Is it possible for you to report the UIA issue against Edge?

If I knew where to do that, I'd certainly would. DO I need to do it against Edge or Chromium? Thoughts @michaelDCurran?

@josephsl

josephsl commented May 28, 2021 via email

Copy link
Copy Markdown
Contributor

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

I think it would be better if NV Access pokes their Microsoft contacts about this.

@LeonarddeR LeonarddeR changed the base branch from master to beta May 28, 2021 13:22
@josephsl

josephsl commented May 28, 2021 via email

Copy link
Copy Markdown
Contributor

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

Well, as long as Google's implementation is experimental, I guess it's up to Microsoft to push fixes upstream.

@Brian1Gaff

Brian1Gaff commented May 28, 2021 via email

Copy link
Copy Markdown

@michaelDCurran michaelDCurran 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.

I am concirned that this may introduce performance issues, Especially also as these days it is important to try and keep the number of cross-process calls in UIA to a minimum with scenarios such as WDAG and RAIL.

In ChromiumUIATextInfo.expand: instead of the added calls to clone and compare, why not just call GetText(1) to fetch the first 1 characters and check if it is the empty string or not. If it is empty, then simply don't call expandToEnclosingUnit.

Although in general you are probably correct that we should call obj.invalidateCache after applying overlay classes, I would prefer this to be in its own pr, where we can very carefully consider and track any performance issues this may cause. This change obviously affects code across NVDA, not just the Edge address bar.
However, to address the specific issue of TextInfos incorrectly being cached here, perhaps we can at least set _cache_TextInfo = False on the UIA NVDAObject which will stop the TextInfo property from being cached. All the major calls it makes internally are cached properties themselves, so this would have no real performance impact, but it would still allow the current value of _TextInfo to be used, thus an overlay with a different TextInfo class would correctly be reflected in speakObject after overlay classes were applied but still in the same core cycle.

…rlay classes are added on top of the object" and set cache attribute on UIA

This reverts commit 800abad.
@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

In ChromiumUIATextInfo.expand: instead of the added calls to clone and compare, why not just call GetText(1) to fetch the first 1 characters and check if it is the empty string or not. If it is empty, then simply don't call expandToEnclosingUnit.

Is that going to work? I assume GetText returns text in the range and doesn't return anything when the range is collapsed, therefore if the range is collapsed, it will never expand.

@michaelDCurran

michaelDCurran commented May 31, 2021 via email

Copy link
Copy Markdown
Member

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

Ah, yeah that makes sence. I changed this as requested.
I also tested every UIA unit and it turns out that it only fails when expanding to line as I originally thought. Therefore I changed the code to only apply when expanding to line. I will change the description accordingly.

@LeonarddeR LeonarddeR requested a review from michaelDCurran May 31, 2021 06:23
@michaelDCurran michaelDCurran merged commit b36375e into nvaccess:beta May 31, 2021
@nvaccessAuto nvaccessAuto added this to the 2021.2 milestone May 31, 2021
@LeonarddeR LeonarddeR deleted the edgeEditFix branch August 23, 2025 06:27
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.

Microsoft Edge/UIA: Expanding an empty text range to line results in a broken IUIAutomationTextRange

7 participants