Skip to content

Commit

Permalink
SearchField/searchui: an overlay class just for Start menu version th…
Browse files Browse the repository at this point in the history
…at disables announcement of newline text. re nvaccess#7370.

Reviewed by Mick Curran (NV Access): better to create an overlay class for this just for searchui. This also allows easy modifications in the future if the need arises.
  • Loading branch information
josephsl committed Jul 11, 2017
1 parent 2260f10 commit 3369381
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 0 additions & 4 deletions source/NVDAObjects/UIA/__init__.py
Expand Up @@ -1468,10 +1468,6 @@ class SearchField(EditableTextWithSuggestions, UIA):
"""An edit field that presents suggestions based on a search term.
"""

def initOverlayClass(self):
# #7370: do not announce text when start menu (searchui) closes.
self.announceNewLineText = self.appModule.appName != "searchui"

def event_UIA_controllerFor(self):
# Only useful if suggestions appear and disappear.
if self == api.getFocusObject() and len(self.controllerFor)>0:
Expand Down
11 changes: 10 additions & 1 deletion source/appModules/searchui.py
@@ -1,10 +1,16 @@
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2015-2016 NV Access Limited
#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.

import appModuleHandler
from NVDAObjects.IAccessible import IAccessible, ContentGenericClient
from NVDAObjects.UIA import UIA, SearchField

class StartMenuSearchField(SearchField):

# #7370: do not announce text when start menu (searchui) closes.
announceNewLineText = False

class AppModule(appModuleHandler.AppModule):

Expand All @@ -16,3 +22,6 @@ def chooseNVDAObjectOverlayClasses(self,obj,clsList):
clsList.remove(ContentGenericClient)
except ValueError:
pass
elif isinstance(obj, UIA):
if obj.UIAElement.cachedAutomationID == "SearchTextBox":
clsList.insert(0, StartMenuSearchField)

0 comments on commit 3369381

Please sign in to comment.