Repository: nvaccess/nvda

Issue:
Windows 10 start menu: search results are not announced with details with recent feature updates
Hi,

Initially, this was a Version 1903 change, but older feature updates do exhibit this problem. A fix is now part of Windows 10 App Essentials add-on and will be part of a separate PR from #10328.

### Background:
In Version 1903 (May 2019 Update), Start menu search experience received an overhaul; powered by window2s Search in addition to being separated somewhat from Cortana (the latter is now the case with 20H1 builds). As part of this redesign (which was subsequently backported to older feature updates via server-side change), results are not announced with details as it used to. Turns out UIA tree is different - sort of a treeview, with categories as results and underneath them are actual results, thus when announcing results, grandparent (not the parent) of the entry must be consulted (thankfully, the parent is recognized as a suggestion list item).

### Steps to reproduce:
For this, NVDA must run with add-ons disabled:

1. Open Start menu.
2. Search for things.
3. Use up or down arrow keys to review search results.

### Actual behavior:
Only the search box content is announced when reviewing results.

### Expected behavior:
Details such as category and position information is announced.

### System configuration
#### NVDA installed/portable/running from source:
Installed

#### NVDA version:
2019.3 alpha.18874

#### Windows version:
Windows 10 Version 1909 (build 18363)

#### Name and version of other software in use when reproducing the issue:
None

#### Other information about your system:
None

### Other questions
#### Does the issue still occur after restarting your PC?
Yes

#### Have you tried any other versions of NVDA? If so, please report their behaviors.
Yes - older versions such as 2018.4 and 21019.2.

### Technical:
See the background section for details. In short, when it comes to recognizing suggestion list item, look at obj.parent instance.

Thanks.


Discussion:
Hi,

Additional information:

1. Currently when reviewing search results, caret helper from editable text class will be invoked, causing NVDA to announce search box value.
2. When one reviews results with braille, output becomes a bit unpredictable - result text do not align to the left. In some cases, only the last word or two from the result will be shown with a cursor indicator next to it.
3. At least what we have in NVDA right now works for speech but not for braille, hence a PR for this.

A possible fix involves recognizing suggestions list item for actual results, not just for search categories. This will result in double-speaking because caret helper will be invoked, and then navigator object will jump to the actual result. At least in braille, this will be shown as a flash message which does align correctly, which is better than unpredictable cursor placement.

Surprisingly, NVDA Core works correctly when reviewing search results from File Explorer in Version 1909 because NVDA does recognize results as proper suggestions list items. There is an issue with that feature, which is a different issue from this.

Thanks.
Hi,

Follow-up: turning off caret line movement script (assiging up and down arrows to None) resolves double-speaking problem with a caveat: results must be announced. AT least in braille, this does allow results o be flashed first before search box content is shown as before (better than unpredictable content presentation).

Thanks.

Resolving patch:
diff --git a/source/NVDAObjects/UIA/__init__.py b/source/NVDAObjects/UIA/__init__.py
--- a/source/NVDAObjects/UIA/__init__.py
+++ b/source/NVDAObjects/UIA/__init__.py
@@ -869,6 +869,7 @@ def findOverlayClasses(self,clsList):
 			# Nested block here in order to catch value error and variable binding error when attempting to access automation ID for invalid elements.
 			try:
 				# #6241: Raw UIA base tree walker is better than simply looking at self.parent when locating suggestion list items.
+				# #10329: 2019 Windows Search results require special handling due to UI redesign.
 				parentElement=UIAHandler.handler.baseTreeWalker.GetParentElementBuildCache(self.UIAElement,UIAHandler.handler.baseCacheRequest)
 				# Sometimes, fetching parent (list control) via base tree walker fails, especially when dealing with suggestions in Windows10 Start menu.
 				# Oddly, we need to take care of context menu for Start search suggestions as well.
diff --git a/source/appModules/searchui.py b/source/appModules/searchui.py
--- a/source/appModules/searchui.py
+++ b/source/appModules/searchui.py
@@ -1,21 +1,25 @@
-#A part of NonVisual Desktop Access (NVDA)
-#Copyright (C) 2015-2017 NV Access Limited, Joseph Lee
-#This file is covered by the GNU General Public License.
-#See the file COPYING for more details.
+# A part of NonVisual Desktop Access (NVDA)
+# Copyright (C) 2015-2019 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.
+"""
 
 import appModuleHandler
+import controlTypes
 from NVDAObjects.IAccessible import IAccessible, ContentGenericClient
-from NVDAObjects.UIA import UIA, SearchField
+from NVDAObjects.UIA import UIA, SearchField, SuggestionListItem
 
 class StartMenuSearchField(SearchField):
 
-		# #7370: do not announce text when start menu (searchui) closes.
+	# #7370: do not announce text when start menu (searchui) closes.
 	announceNewLineText = False
 
 class AppModule(appModuleHandler.AppModule):
 
 	def chooseNVDAObjectOverlayClasses(self,obj,clsList):
-		if isinstance(obj,IAccessible):
+		if isinstance(obj, IAccessible):
 			try:
 				# #5288: Never use ContentGenericClient, as this uses displayModel
 				# which will freeze if the process is suspended.
@@ -25,3 +29,7 @@ def chooseNVDAObjectOverlayClasses(self,obj,clsList):
 		elif isinstance(obj, UIA):
 			if obj.UIAElement.cachedAutomationID == "SearchTextBox":
 				clsList.insert(0, StartMenuSearchField)
+			# #10329: Since 2019, some suggestion items are grouped inside another suggestions list item.
+			# Because of this, result details will not be announced like in the past.
+			elif obj.role == controlTypes.ROLE_LISTITEM and isinstance(obj.parent, SuggestionListItem):
+				clsList.insert(0, SuggestionListItem)


Test patch: