Repository: nvaccess/nvda

Issue:
Windows 10/Windows Search: add support for File Explorer embedded search experience in Version 1909 and later
Hi,

Another one in a series of issues on Windows 10/Windows Search:

### Background:
Windows 10 Version 1909 (likely to be called October 2019 Update) and later includes online search capability in File Explorer. This feature, powered by redesigned Windows Search, is used to allow users to search OneDrive content. As the search progresses, a live region informs result count. Because of the way search box is handled, braille will initially display "suggestions" instead of displaying this live region.

### Is your feature request related to a problem? Please describe.
As noted above, a live region text is used to announce results count. Unfortunately this region isn't labeled, and the text itself is the first child of this region, necessitating NVDA descending one level to announce this live region.

Also, when using braille, the word "suggestions" is brailed before the live region is displayed. This is caused by search box recognition code in SearchUI app module where Start menu search field is recognized as a pure UIA search field. Thus suggestionsOpened event must be modified in sTart menu search field to not braille suggestions message (a separate issue but is grouped under this one to provide context).

### Describe the solution you'd like
Add support for Version 1909 File Explorer/Windows Search facility by:

1. For the live region: give it the name of the child object so live region change event can function properly.
2. Add a custom version of suggestionsOpened event for Start menu search field so braille won't have to say "suggestions".
3. Optionally, rename searchui.StartMenuSearchField to something else (later).

### Describe alternatives you've considered
Leave it as is.

### Additional context
The fix described above is part of Windows 10 App Essentials add-on and is being tested. Also, it would be ideal to see this feature implemented by 2019.3 or shortly after. Also, in 20H1, Windows Search executable has been renamed to SearchApp.exe, so we need to take care of that by 2020.1 release.

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,5 +1,5 @@
 # A part of NonVisual Desktop Access (NVDA)
-# Copyright (C) 2015-2019 NV Access Limited, Joseph Lee
+# Copyright (C) 2015-2021 NV Access Limited, Joseph Lee
 # This file is covered by the GNU General Public License.
 # See the file COPYING for more details.
 
@@ -8,6 +8,7 @@
 
 import appModuleHandler
 import controlTypes
+import winVersion
 from NVDAObjects.IAccessible import IAccessible, ContentGenericClient
 from NVDAObjects.UIA import UIA, SearchField, SuggestionListItem
 
@@ -18,6 +19,19 @@ class StartMenuSearchField(SearchField):
 
 class AppModule(appModuleHandler.AppModule):
 
+	def event_NVDAObject_init(self, obj):
+		if isinstance(obj, UIA):
+			# #10341: Build 18363 introduces modern search experience in File Explorer.
+			# As part of this, suggestion count is part of a live region.
+			# Although it is geared for Narrator, it is applicable to other screen readers as well.
+			# The live region itself is a child of the one shown here.
+			if (
+				winVersion.getWinVer() >= winVersion.WIN10_1909
+				and obj.UIAAutomationId == "suggestionCountForNarrator"
+				and obj.firstChild is not None
+			):
+				obj.name = obj.firstChild.name
+
 	def chooseNVDAObjectOverlayClasses(self,obj,clsList):
 		if isinstance(obj, IAccessible):
 			try:
@@ -27,7 +41,7 @@ def chooseNVDAObjectOverlayClasses(self,obj,clsList):
 			except ValueError:
 				pass
 		elif isinstance(obj, UIA):
-			if obj.UIAElement.cachedAutomationID == "SearchTextBox":
+			if obj.UIAAutomationId == "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.


Test patch: