nvaccess / nvda

NVDA, the free and open source Screen Reader for Microsoft Windows
https://www.nvaccess.org/
Other
2.1k stars 634 forks source link

NVDA loses focus after a Windows notification is received #14039

Open rperez030 opened 2 years ago

rperez030 commented 2 years ago

Steps to reproduce:

This issue may be difficult to reproduce because it is a random one.

  1. Use Windows and windows applications normally.
  2. at some point, NVDA will start speaking an incoming Windows notification, and speech will get interrupted in the process.

    Actual behavior:

    When a Windows notification is received and text is being edited the cursor will also get stuck, and pressing arrow keys will not cause any change in speech or braille. reading command such as NVDA +T to read the window title seem to work normally. Calling devInfo produces the following output in the log:

Developer info for navigator object:
name: ''
role: Role.WINDOW
roleText: None
states: exception: (-2147220991, 'An event was unable to invoke any of the subscribers', (None, None, None, 0, None))
isFocusable: exception: (-2147220991, 'An event was unable to invoke any of the subscribers', (None, None, None, 0, None))
hasFocus: False
Python object: <NVDAObjects.UIA.Toast_win10 object at 0x0731AD70>
Python class mro: (<class 'NVDAObjects.UIA.Toast_win10'>, <class 'NVDAObjects.behaviors.Notification'>, <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: None
value: exception: (-2147220991, 'An event was unable to invoke any of the subscribers', (None, None, None, 0, None))
TextInfo: <class 'NVDAObjects.NVDAObjectTextInfo'>
appModule: <'shellexperiencehost' (appName 'shellexperiencehost', process ID 14504) at address 723cfd0>
appModule.productName: 'Microsoft.Windows.ShellExperienceHost'
appModule.productVersion: '10.0.25179.1000'
appModule.helperLocalBindingHandle: c_long(91758704)
windowHandle: 66742
windowClassName: 'Windows.UI.Core.CoreWindow'
windowControlID: 0
windowStyle: -1811939328
extendedWindowStyle: 2097160
windowThreadID: 14856
windowText: ''
displayText: exception: cannot unpack non-iterable NoneType object
UIAElement: <POINTER(IUIAutomationElement) ptr=0x553da28 at 7235c60>
UIA automationID: Exception: (-2147220991, 'An event was unable to invoke any of the subscribers', (None, None, None, 0, None))
UIA frameworkID: XAML
UIA runtimeID: (42, 66742, 4, 1)
UIA providerDescription: [pid:14504,providerId:0x0 Main(parent link):Unidentified Provider (unmanaged:Windows.UI.Xaml.dll)]
UIA className: Exception: (-2147220991, 'An event was unable to invoke any of the subscribers', (None, None, None, 0, None))
UIA patterns available: 

Expected behavior:

NVDA should speak the entire window notification unless interrupted manually, and I should be able to continue working normally.

Work around:

The way to get out of this situation seems to be switching to another Window and immediately switch back.

NVDA logs, crash dumps and other attachments:

System configuration

NVDA installed/portable/running from source:

Installed

NVDA version:

2022.2

Windows version:

Edition Windows 11 Enterprise Insider Preview Version 22H2 OS build 25179.1000 Experience Windows Feature Experience Pack 1000.25179.1000.0

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

Not applicable.

Other information about your system:

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.

It also happens with the previous version 2022.1.

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

I cannot tell since it occurs randomly.

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

Yes

kianoosh-shakeri commented 2 years ago

Yes, I have the same issue on NVDA version 2022.3 Beta3 and Windows 11 22H2 (x64) build 22622.575. It's very annoying for those of us that receive notifications often.

jcsteh commented 1 year ago

Windows, in its infinite wisdom, seems to sometimes throw focus to a useless UIA element hosted in shellexperiencehost after a notification is presented. It doesn't always happen (for me at least), which makes it hard to diagnose.

akash07k commented 1 year ago

Yes, I too face this issue very frequently as I receive numerous notifications from different applications

Adriani90 commented 1 year ago

@jcsteh Maybe this could be also the cause for #8389?

I've also noticed the same wrong focus redirecting when opening the context menu of an icon in system tray and then pressing escape to close the menu. Mostly NVDA will report very strange windo titles and the focus is not falling back to the system tray.

Very reliably to reproduce with the Bluetooth devices icon in the system tray. After pressing escape, NVDA reports "Bluetooth notification area icon window class". No idea why NVDA thinks the focus is on a notification area.

This happens with every icon which has potentially the feature to issue notifications.

Actually NVDA should never automatically focus the notification area unless you open the notification center.

cc: @josephsl

jcsteh commented 1 year ago

Confusing as it might be, "Windows notifications" (i.e. the notification centre) and the "notification area" (AKA the system tray) are two different things.

This issue is about Windows notifications. After a Windows notification appears, Windows sometimes (but not always) throws focus to a useless element. I suspect this element doesn't really have the focus, but I'm not sure yet because I can't reproduce it reliably. Either way, this is a Windows bug, but if focus isn't really going there and it's just a rogue focus event, NVDA can probably be taught to ignore it.

System tray icons are a different matter. The application chooses what to do when dismissing its system tray menu. When you dismiss the Bluetooth menu, NVDA doesn't just incorrectly think focus went to the "Bluetooth notification area icon window class". Focus actually does go to a hidden window with that title. It shouldn't, but that's a Windows bug and not something NVDA can fix. Even if NVDA could work around this (e.g. by forcing focus somewhere else), it would be different for every application with a system tray icon, so that kind of workaround just isn't feasible.

Adriani90 commented 9 months ago

I cannot reproduce this issue with NVDA2024.1 Beta and Windows 11 23 H2. Is this issue still occuring for anyone of you @rperez030, @kianoosh-shakeri or @akash07k? IN my case NVDA is directly redirected to the notification overlay, where NVDA reads the notification. Pressing tab brings me to buttons to interact with the notification. Note that this overlay is not the complete notification center, it is just an overlay with some buttons for the current notification.

beqabeqa473 commented 9 months ago

yes, this issue is occuring to me always a notification is received on win 11 23h2

On 1/20/24, Adriani90 @.***> wrote:

I cannot reproduce this issue with NVDA2024.1 Beta and Windows 11 23 H2. Is this issue still occuring for anyone of you @rperez030, @kianoosh-shakeri or @akash07k? IN my case NVDA is directly redirected to the notification overlay, where NVDA reads the notification. Pressing tab brings me to buttons to interact with the notification. Note that this overlay is not the complete notification center, it is just an overlay with some buttons for the current notification.

-- Reply to this email directly or view it on GitHub: https://github.com/nvaccess/nvda/issues/14039#issuecomment-1902097501 You are receiving this because you are subscribed to this thread.

Message ID: @.***>

-- with best regards Beqa Gozalishvili Tell: +995593454005 Email: @.*** Web: https://gozaltech.org Skype: beqabeqa473 Telegram: https://t.me/gozaltech facebook: https://facebook.com/gozaltech twitter: https://twitter.com/beqabeqa473 Instagram: https://instagram.com/beqa.gozalishvili