Repository: nvaccess/nvda

Issue:
Windows 10/11 Start menu search: NVDA does not announce search results with details when tabbing through results
Hi,

This is a 2022 update to #10329 

### Background:
From time to time Microsoft makes server side changes to Windows Search experience, including Start meu search box in Windows 10 and 11. With a new layout implemented in 2020 or so, NVDA does not announce search results with details, more prominent when tabbing through results in Windows 11.

### Steps to reproduce:

#### Method 1: scroll through search results
1. Press Windows key to open Start menu.
2. Type something.
3. When the first search result is dislayed, press down arrow to review results.

#### Method 2: tab through search results
1. Open Start menu.
2. Type something.
3. Wen the first result is displayed, press Tab to move through results.

### Actual behavior:
* Method 1: NVDA does not announce search details such as category (app, web, etc.) when pressing down arrow to review results.
* Method 2: NVDA is silent when moving to search categories.

### Expected behavior:
NVDA announces results with details.

### System configuration
#### NVDA installed/portable/running from source:
Installed

#### NVDA version:
alpha-25094,307c8902

#### Windows version:
Windows 11 Version 21H2 (build 22000)

#### Name and version of other software in use when reproducing the issue:
None

#### Other information about your system:
While the version shown is for the stable Windows 11 release, the computer is used to test virtual machines, including older and newer Windows releases

### 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.
2019.2 and later (the latest version installed on a virtual machine running Windows 10 Version 1803, the first release with this problem)

#### If NVDA 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

### Solution
In SearchUI app module (specifically, when choosing suggestion list item in overlay classes chooser), in addition to checking for object parent, also check if obj.parent.parent is indeed a results list. A more useful solution would be window class names, but the same class name is used in places other than results list, which can confuse NVDA and users as to what to do.

A prototype of this fix will be part of Windows App Essentials add-on development snapshot for March 28, 2022 (prototype testing in progress), and eventually will be proposed as a pull request in mid-April at the earliest.

Thanks.


Discussion:

Resolving patch:
diff --git a/source/appModules/searchui.py b/source/appModules/searchui.py
--- a/source/appModules/searchui.py
+++ b/source/appModules/searchui.py
@@ -1,9 +1,11 @@
 # A part of NonVisual Desktop Access (NVDA)
-# Copyright (C) 2015-2021 NV Access Limited, Joseph Lee
+# Copyright (C) 2015-2022 NV Access Limited, Joseph Lee
 # This file is covered by the GNU General Public License.
 # See the file COPYING for more details.
 
 """App module for Start menu/Windows Search/Cortana user interface in Windows 10 Version 1909 and earlier.
+This app module also serves as the basis for Start menu in Windows 10 Version 2004 and later
+as well as Windows 11, represented by alias app modules.
 """
 
 import appModuleHandler
@@ -12,11 +14,13 @@
 from NVDAObjects.IAccessible import IAccessible, ContentGenericClient
 from NVDAObjects.UIA import UIA, SearchField, SuggestionListItem
 
+
 class StartMenuSearchField(SearchField):
 
 	# #7370: do not announce text when start menu (searchui) closes.
 	announceNewLineText = False
 
+
 class AppModule(appModuleHandler.AppModule):
 
 	def event_NVDAObject_init(self, obj):
@@ -32,7 +36,7 @@ def event_NVDAObject_init(self, obj):
 			):
 				obj.name = obj.firstChild.name
 
-	def chooseNVDAObjectOverlayClasses(self,obj,clsList):
+	def chooseNVDAObjectOverlayClasses(self, obj, clsList):
 		if isinstance(obj, IAccessible):
 			try:
 				# #5288: Never use ContentGenericClient, as this uses displayModel
@@ -44,6 +48,12 @@ def chooseNVDAObjectOverlayClasses(self,obj,clsList):
 			if obj.UIAAutomationId == "SearchTextBox":
 				clsList.insert(0, StartMenuSearchField)
 			# #10329: Since 2019, some suggestion items are grouped inside another suggestions list item.
+			# #13544: grandparent must be checked due to redesign in 2019.
 			# Because of this, result details will not be announced like in the past.
-			elif obj.role == controlTypes.Role.LISTITEM and isinstance(obj.parent, SuggestionListItem):
+			elif (
+				obj.role == controlTypes.Role.LISTITEM and (
+					isinstance(obj.parent, SuggestionListItem)
+					or isinstance(obj.parent.parent, SuggestionListItem)
+				)
+			):
 				clsList.insert(0, SuggestionListItem)


Test patch: