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

Windows 11: a "pane" window gets focus when switching to certain apps, including Command Prompt #12648

Closed
josephsl opened this issue Jul 15, 2021 · 16 comments · Fixed by #12944
Closed
Milestone

Comments

@josephsl
Copy link
Collaborator

Hi,

Related: #12585

The following was reported on Twitter, and a discussion about this took place between I, @ctoth, and several users.

Steps to reproduce:

With Windows 11 preview installed:

  1. Open several apps.
  2. Run Command Prompt, Windows Terminal, or other application, preferably running Windows Subsystem for Linux (WSL) 2 shell active.
  3. Switch to a different app.
  4. Switch to Command Prompt.

Actual behavior:

Focus lands on "pane" window.

Expected behavior:

Focus lands on Command Prompt.

System configuration

NVDA installed/portable/running from source:

Installed

NVDA version:

2021.1, alpha-23336,9409b9dd

Windows version:

Windows 11 preview (build 22000.65)

Name and version of other software in use when reproducing the issue:

Command Prompt, Windows Terminal 1.9

Other information about your system:

A virtual machine running Insider Preview builds

Other questions

Does the issue still occur after restarting your computer?

Yes

Have you tried any other versions of NVDA? If so, please report their behaviors.

Older versions such as 2020.4 behave the same.

If add-ons are disabled, is your problem still occurring?

Yes

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

Not applicable

Additional context:

Currently a fix was deployed through Windows App Essentials, and @ctoth points out that it should be part of NVDA to begin with as this is a basic user experience issue.

Developer info for the pane object:

name: ''
role: ROLE_PANE
roleText: None
states: STATE_FOCUSED
isFocusable: False
hasFocus: True
Python object: <NVDAObjects.UIA.UIA object at 0x06EEB5B0>
Python class mro: (<class 'NVDAObjects.UIA.UIA'>, <class 'NVDAObjects.window.Window'>, <class 'NVDAObjects.NVDAObject'>, <class 'documentBase.TextContainerObject'>, <class 'baseObject.ScriptableObject'>, <class 'baseObject.AutoPropertyObject'>, <class 'garbageHandler.TrackedObject'>, <class 'object'>)
description: ''
location: RectLTWH(left=0, top=0, width=1600, height=1152)
value: None
appModule: <'explorer' (appName 'explorer', process ID 5928) at address 6d0e890>
appModule.productName: 'Microsoft® Windows® Operating System'
appModule.productVersion: '10.0.22000.51'
TextInfo: <class 'NVDAObjects.NVDAObjectTextInfo'>
windowHandle: 853144
windowClassName: 'Windows.UI.Input.InputSite.WindowClass'
windowControlID: 0
windowStyle: 1342177280
extendedWindowStyle: 0
windowThreadID: 6424
windowText: ''
displayText: ''
UIAElement: <POINTER(IUIAutomationElement) ptr=0x397a728 at 701c120>
UIA automationID:
UIA frameworkID: XAML
UIA runtimeID: (42, 853144)
UIA providerDescription: [pid:4556,providerId:0xD0498 Main:Nested [pid:5928,providerId:0xD0498 Main(parent link):Unidentified Provider (unmanaged:Windows.UI.Xaml.dll)]; Hwnd(parent link):Microsoft: HWND Proxy (unmanaged:UIAutomationCore.dll)]
UIA className: Windows.UI.Input.InputSite.WindowClass
UIA patterns available: LegacyIAccessiblePattern

Proposed solution:

Let NvDA ignore UIA focus event for this window, which then allows NVDA to notice that Command Prompt was focused. The ideal solution should come from Microsoft, and since Windows 11 is in preview, things can change, making the PR a bit risky (we need to revert changes if Microsoft fixes this).

Thanks.

@josephsl
Copy link
Collaborator Author

CC @codeofdusk because this may impact work on potential Windows 11 console support.

@josephsl
Copy link
Collaborator Author

CC @zersiax

@codeofdusk
Copy link
Contributor

I can repro on latest Win11 insider build, filed as Windows bug 34627510 (Windows 11: accessibility focus lands on pane window when switching to conhost with alt+tab).

@codeofdusk
Copy link
Contributor

Keep your eyes peeled for a fix :)

@josephsl
Copy link
Collaborator Author

josephsl commented Jul 22, 2021 via email

@codeofdusk
Copy link
Contributor

codeofdusk commented Jul 23, 2021

No longer repros in Windows 11 insider builds after 22000.111. This issue should be closed as fixed externally.

@josephsl
Copy link
Collaborator Author

josephsl commented Jul 23, 2021 via email

@codeofdusk
Copy link
Contributor

No, not 22000.111, but a build after that.

@josephsl
Copy link
Collaborator Author

josephsl commented Jul 24, 2021 via email

@codeofdusk
Copy link
Contributor

Actually, I can still repro under co_refresh. Following up internally.

@josephsl
Copy link
Collaborator Author

Hi,

Not resolved in 22000.160. I'll consider a quick pull request to fix this and "Task Switching" announcement issue if this problem is confirmed by release preview Insiders (coming soon).

Possible solution from NVDA side: editing gain focus event found in Explorer app module might suffice for now. Note that window class name should not be checked for "pane" announcement as shell elements are tagged as "Windows.UI.Input.InputSite.WindowClass" which will cause Taskbar items and other shell elements to not be announced if gain focus event is vetoed. For Task Switching window, window class name can be checked as it is an MSAA object, whereas input site window is a UIA element. Ideally the solution is seeing if this is resolved in cobalt refresh or nickel/copper dev semesters (eventually backported/cherry-picked into cobalt release/servicing branch) a.k.a. not editing NVDA source code.

Thanks.

@codeofdusk
Copy link
Contributor

22000.160

External dev builds will lag behind the cutting edge by at least a few weeks due to reverse-integration of changes. Sadly, I don't have access to the bug tracker any more due to the conclusion of my internship.

@DHowett did they mark bug 34627510 as won't fix again? It severely affects all UIA clients on Cobalt.

@josephsl
Copy link
Collaborator Author

josephsl commented Sep 5, 2021

Hi,

Since this problem also occurs in nickel build 22449 and Windows 11 official release date is set, I'll do everything I can to get the accompanying pull request into NVDA 2021.3 at the earliest. Also, after further testing, the solution is a lot simpler than I thought: treating "pane" windows as multitasking view frame from Windows 8.x/10 days.

Thanks.

@codeofdusk
Copy link
Contributor

codeofdusk commented Sep 5, 2021

Since this problem also occurs in nickel build 22449

I'm still working on this from the MS side! If it still repros after the next nickel build (no longer have internal access) then we should seek an NVDA side resolution. Also hoping to see this RIed into cobalt.

@josephsl
Copy link
Collaborator Author

josephsl commented Sep 5, 2021 via email

@josephsl
Copy link
Collaborator Author

Hi,

Update: as the problem still exists in build 22000.258 (KB5006674), I will wait and see if build 22478 resolves this, and if not, I will take care of this problem as soon as I'm done with graduate school midterm this weekend (I'm bumping this to top priority for me).

Thanks.

josephsl added a commit to josephsl/nvda that referenced this issue Oct 17, 2021
…e window in Windows 11. Re nvaccess#12648.

When switching tasks in Windows 11, sometimes an unknown 'pane' window gets focused instead of the app being switched to. Therefore detect this pane window and treat it as a Windows 10 multitasking view frame window which suppresses UIA focus event.
seanbudd added a commit that referenced this issue Oct 18, 2021
…itching tasks (#12944)

Closes #12648

Summary of the issue:
When switching tasks in Windows 11, a "pane" window gets focused instead of the app being switched to in some cases.

Description of how this pull request fixes the issue:
Treat InputSite window class window as a Windows 10 MultitaskingViewFrameWindow object which suppresses UIA focus event.

Testing strategy:
Manual testing on Windows 11 (prerequisite: Windows App Essentials add-on must be disabled):

Without the patch applied, try switching between tasks.
With the patch applied, try switching between tasks.
Expected: NVDA will say "pane" in scenario 1, whereas NVDA will not say "pane" in scenario 2 when switching tasks.

Commits:

* Explorer app module: update copyright year

* appModules/Explorer: suppress UIA focus event for task switching frame window in Windows 11. Re #12648.

When switching tasks in Windows 11, sometimes an unknown 'pane' window gets focused instead of the app being switched to. Therefore detect this pane window and treat it as a Windows 10 multitasking view frame window which suppresses UIA focus event.

* update changes

Co-authored-by: buddsean <sean@nvaccess.org>
@nvaccessAuto nvaccessAuto added this to the 2021.3 milestone Oct 18, 2021
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 a pull request may close this issue.

3 participants