Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly initialize XamlUiaTextRange with ProviderFromPeer #11501

Merged
4 commits merged into from
Oct 13, 2021

Conversation

carlos-zamora
Copy link
Member

Summary of the Pull Request

As a part of the Interactivity split, TermControlAutomationPeer had to be split into TermControlAutomationPeer (TCAP) and InteractivityAutomationPeer (IAP). Just about all of the functions in InterativityAutomationPeer operate by calling the non-XAML UIA Provider then wrapping the resulting UIATextRange into a XAML format (a XamlUiaTextRange [XUTR]). As a part of that XUTR constructor, we need a reference to the parent provider.

We generally get that via ProviderFromPeer(), but IAP's ProviderFromPeer() returned null (presumably because IAP isn't in the UI tree, whereas TCAP is directly registered as the automation peer for the TermControl).

It looks like some screen readers didn't care (like NVDA, though there may be a chance we just didn't encounter an issue just yet), but Narrator definitely did.

The fix was to provide XUTR constructors the ProviderFromPeer from TCAP, not IAP. To accomplish this, IAP now holds a weak reference to TCAP, and provides the ProviderFromPeer when needed. We can't cache this result because there is no guarantee that it won't change.

Some miscellaneous changes include:

  • TermControl::OnCreateAutomationPeer now returns the existing auto peer instead of always creating a new one
  • TCAP::WrapArrayOfTextRangeProviders was removed as it was unused (normally, this would be directly affected by the main ProviderFromPeer change here)
  • XUTR::GetEnclosingElement is now hooked up to trace logging for debugging purposes

References

Introduced in #10051
Closes #11488

Validation Steps Performed

✅ Narrator scan mode now works (verified with character, word, and line navigation)
✅ NVDA movement still works (verified with word and line navigation)

@ghost ghost added Area-Accessibility Issues related to accessibility Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-0 Bugs that we consider release-blocking/recall-class (P0) Product-Terminal The new Windows Terminal. Severity-Blocking We won't ship a release like this! No-siree. labels Oct 13, 2021
@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 13, 2021
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 13, 2021
@DHowett DHowett added the zStable-Service-Queued-1.12 A floating label that tracks the current Stable version for servicing purposes. label Oct 13, 2021
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

holy lol

4150609

@DHowett
Copy link
Member

DHowett commented Oct 13, 2021

Fix the build (and maybe the comment i guess) 😄 and we can merge it!

/cc @PankajBhojwani as release engineer- this is going to merge soon and must be picked over to 1.11.

@carlos-zamora
Copy link
Member Author

@msftbot merge this in 5 minutes

@ghost ghost added the AutoMerge Marked for automatic merge by the bot when requirements are met label Oct 13, 2021
@ghost
Copy link

ghost commented Oct 13, 2021

Hello @carlos-zamora!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I won't merge this pull request until after the UTC date Wed, 13 Oct 2021 22:38:52 GMT, which is in 5 minutes

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@ghost ghost merged commit 02ac246 into main Oct 13, 2021
@ghost ghost deleted the dev/cazamor/a11y/a-tale-of-two-auto-peers branch October 13, 2021 23:01
PankajBhojwani pushed a commit that referenced this pull request Oct 13, 2021
## Summary of the Pull Request
As a part of the Interactivity split, `TermControlAutomationPeer` had to be split into `TermControlAutomationPeer` (TCAP) and `InteractivityAutomationPeer` (IAP). Just about all of the functions in `InterativityAutomationPeer` operate by calling the non-XAML UIA Provider then wrapping the resulting `UIATextRange` into a XAML format (a `XamlUiaTextRange` [XUTR]). As a part of that XUTR constructor, we need a reference to the parent provider.

We generally get that via `ProviderFromPeer()`, but IAP's `ProviderFromPeer()` returned null (presumably because IAP isn't in the UI tree, whereas TCAP is directly registered as the automation peer for the `TermControl`).

It looks like some screen readers didn't care (like NVDA, though there may be a chance we just didn't encounter an issue just yet), but Narrator definitely did.

The fix was to provide XUTR constructors the `ProviderFromPeer` from TCAP, _not_ IAP. To accomplish this, IAP now holds a weak reference to TCAP, and provides the `ProviderFromPeer` when needed. We can't cache this result because there is no guarantee that it won't change.

Some miscellaneous changes include:
- `TermControl::OnCreateAutomationPeer` now returns the existing auto peer instead of always creating a new one
- `TCAP::WrapArrayOfTextRangeProviders` was removed as it was unused (normally, this would be directly affected by the main `ProviderFromPeer` change here)
- `XUTR::GetEnclosingElement` is now hooked up to trace logging for debugging purposes

## References
Introduced in #10051
Closes #11488 

## Validation Steps Performed
✅ Narrator scan mode now works (verified with character, word, and line navigation)
✅ NVDA movement still works (verified with word and line navigation)
PankajBhojwani pushed a commit that referenced this pull request Oct 15, 2021
## Summary of the Pull Request
As a part of the Interactivity split, `TermControlAutomationPeer` had to be split into `TermControlAutomationPeer` (TCAP) and `InteractivityAutomationPeer` (IAP). Just about all of the functions in `InterativityAutomationPeer` operate by calling the non-XAML UIA Provider then wrapping the resulting `UIATextRange` into a XAML format (a `XamlUiaTextRange` [XUTR]). As a part of that XUTR constructor, we need a reference to the parent provider.

We generally get that via `ProviderFromPeer()`, but IAP's `ProviderFromPeer()` returned null (presumably because IAP isn't in the UI tree, whereas TCAP is directly registered as the automation peer for the `TermControl`).

It looks like some screen readers didn't care (like NVDA, though there may be a chance we just didn't encounter an issue just yet), but Narrator definitely did.

The fix was to provide XUTR constructors the `ProviderFromPeer` from TCAP, _not_ IAP. To accomplish this, IAP now holds a weak reference to TCAP, and provides the `ProviderFromPeer` when needed. We can't cache this result because there is no guarantee that it won't change.

Some miscellaneous changes include:
- `TermControl::OnCreateAutomationPeer` now returns the existing auto peer instead of always creating a new one
- `TCAP::WrapArrayOfTextRangeProviders` was removed as it was unused (normally, this would be directly affected by the main `ProviderFromPeer` change here)
- `XUTR::GetEnclosingElement` is now hooked up to trace logging for debugging purposes

## References
Introduced in #10051
Closes #11488

## Validation Steps Performed
✅ Narrator scan mode now works (verified with character, word, and line navigation)
✅ NVDA movement still works (verified with word and line navigation)

(cherry picked from commit 02ac246)
@PankajBhojwani PankajBhojwani removed the zStable-Service-Queued-1.12 A floating label that tracks the current Stable version for servicing purposes. label Oct 15, 2021
zadjii-msft added a commit that referenced this pull request Apr 15, 2022
…een wrong. I get all sorts of errors. I should to the opposite.
zadjii-msft added a commit that referenced this pull request Apr 15, 2022
…o have been wrong. I get all sorts of errors. I should to the opposite."

This reverts commit bf0f516.
zadjii-msft added a commit that referenced this pull request Apr 18, 2022
…een wrong. I get all sorts of errors. I should to the opposite.

(cherry picked from commit bf0f516)
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Accessibility Issues related to accessibility AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-0 Bugs that we consider release-blocking/recall-class (P0) Product-Terminal The new Windows Terminal. Severity-Blocking We won't ship a release like this! No-siree.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Narrator scan mode *does not work* in 1.11+
4 participants