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

Introduce PseudoConsoleWindow a11y provider #14541

Merged
5 commits merged into from
Jan 12, 2023

Conversation

carlos-zamora
Copy link
Member

@carlos-zamora carlos-zamora commented Dec 13, 2022

In order to modify the accessibility information for the PseudoConsoleWindow, it needs to have a UIA provider registered. This PR introduces PseudoConsoleWindowAccessibilityProvider and registers it as a UIA provider appropriately. The registration process is based on that of the WindowUiaProvider for ConHost.

Closes #14385

Validation Steps Performed

Run Accessibility Insights FastPass on the window. The PseudoConsoleWindow no longer is tagged as missing a name.

@ghost ghost added Area-Accessibility Issues related to accessibility Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. labels Dec 13, 2022
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

It would be very much better if this window could be yeeted out of the a11y tree, because it contains no user-useful information and should not under any circumstances be user-accessible.

This PR fixes the symptom, "the window that nobody should access has no name," rather than the cause -- is it possible to fix the cause?

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Dec 13, 2022
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.

Yea hard block. The conpty window, by all accounts, should not be something the user EVER interacts with.

Comment on lines 76 to 85
else if (propertyId == UIA_IsControlElementPropertyId)
{
pVariant->vt = VT_BOOL;
pVariant->boolVal = VARIANT_FALSE;
}
else if (propertyId == UIA_IsContentElementPropertyId)
{
pVariant->vt = VT_BOOL;
pVariant->boolVal = VARIANT_FALSE;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@DHowett @zadjii-msft
So, in XAML, you can set the AccessibilityView to Raw to remove it from the UIA tree. This is actually an abstraction:

AccessibilityView IsControlElement IsContentElement
Raw false false
Control true false
Content true true

Source: https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-treeoverview

By setting both of these to false, we're essentially "removing" this from the UIA tree. However, you can't really remove it. It's just accessible if you want the raw version of the tree.

This distinction is particularly important for Accessibility Insights. Unfortunately, the FastPass tool navigates through the UIA tree and looks for common errors. So, it still finds this PseudoConsoleWindow and complains that it needs a name (unfortunately).

To make matters worse, even with this fix where we change it to Raw and give it a name, we're still getting a bug from FastPass saying that we should set IsControlElement to true. But for the reasons you've stated, we obviously don't want that.

Idk if there's a way to exclude this window from FastPass. Like we said, it's not focusable. We basically want to completely omit this from the UIA tree, but this is as close as we can get, it seems.

Copy link
Member

Choose a reason for hiding this comment

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

Got it! Thank you!

@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Dec 13, 2022
src/interactivity/base/InteractivityFactory.cpp Outdated Show resolved Hide resolved
HRESULT PseudoConsoleWindowAccessibilityProvider::RuntimeClassInitialize(HWND pseudoConsoleHwnd) noexcept
{
RETURN_HR_IF_NULL(E_INVALIDARG, pseudoConsoleHwnd);
_pseudoConsoleHwnd = pseudoConsoleHwnd;
Copy link
Member

Choose a reason for hiding this comment

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

is there any compelling need for the PCWAP to keep a handle to its owning window?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just this:

IFACEMETHODIMP PseudoConsoleWindowAccessibilityProvider::get_HostRawElementProvider(_COM_Outptr_result_maybenull_ IRawElementProviderSimple** ppProvider)
{
RETURN_HR_IF_NULL(E_INVALIDARG, ppProvider);
RETURN_HR_IF_NULL(gsl::narrow_cast<HRESULT>(UIA_E_ELEMENTNOTAVAILABLE), _pseudoConsoleHwnd);
return UiaHostProviderFromHwnd(_pseudoConsoleHwnd, ppProvider);
}

Comment on lines 76 to 85
else if (propertyId == UIA_IsControlElementPropertyId)
{
pVariant->vt = VT_BOOL;
pVariant->boolVal = VARIANT_FALSE;
}
else if (propertyId == UIA_IsContentElementPropertyId)
{
pVariant->vt = VT_BOOL;
pVariant->boolVal = VARIANT_FALSE;
}
Copy link
Member

Choose a reason for hiding this comment

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

Got it! Thank you!

src/interactivity/base/InteractivityFactory.cpp Outdated Show resolved Hide resolved
src/interactivity/base/InteractivityFactory.hpp Outdated Show resolved Hide resolved
src/interactivity/base/InteractivityFactory.hpp Outdated Show resolved Hide resolved
@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Dec 13, 2022
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Dec 15, 2022
@DHowett DHowett dismissed zadjii-msft’s stale review December 16, 2022 22:17

He gone for the year!

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.

Thanks for the explanation yesterday - we need to add UIA support, so that we can tell UIA that we aren't a thing. Crazy, but okay.

@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jan 12, 2023
@ghost
Copy link

ghost commented Jan 12, 2023

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 09273be into main Jan 12, 2023
@ghost ghost deleted the dev/cazamor/a11y/pseudo-console-window branch January 12, 2023 00:06
DHowett pushed a commit that referenced this pull request Jan 13, 2023
In order to modify the accessibility information for the PseudoConsoleWindow, it needs to have a UIA provider registered. This PR introduces `PseudoConsoleWindowAccessibilityProvider` and registers it as a UIA provider appropriately. The registration process is based on that of the `WindowUiaProvider` for ConHost.

Closes #14385

## Validation Steps Performed
Run Accessibility Insights FastPass on the window. The PseudoConsoleWindow no longer is tagged as missing a name.

(cherry picked from commit 09273be)
Service-Card-Id: 87568605
Service-Version: 1.16
@ghost
Copy link

ghost commented Jan 24, 2023

🎉Windows Terminal v1.16.1023 (10231 and 10232) has been released which incorporates this pull request.:tada:

Handy links:

@ghost
Copy link

ghost commented Jan 24, 2023

🎉Windows Terminal Preview v1.17.1023 has been released which incorporates this pull request.:tada:

Handy links:

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. Product-Terminal The new Windows Terminal.
Projects
None yet
3 participants