diff --git a/source/appModules/explorer.py b/source/appModules/explorer.py index a279f167852..9ad19359852 100644 --- a/source/appModules/explorer.py +++ b/source/appModules/explorer.py @@ -44,6 +44,12 @@ def _get_container(self): return super(MultitaskingViewFrameListItem, self).container +class SearchBoxClient(IAccessible): + # #20021: File Explorer can fire a redundant MSAA focus event on the search band pane + # immediately after the UIA SearchEditBox gains focus. + shouldAllowIAccessibleFocusEvent = False + + # Class for menu items for Windows Places and Frequently used Programs (in start menu) # Also used for desktop items class SysListView32EmittingDuplicateFocusEvents(IAccessible): @@ -225,6 +231,14 @@ def chooseNVDAObjectOverlayClasses(self, obj, clsList): # NOQA: C901 windowClass = obj.windowClassName role = obj.role + if ( + windowClass in ("Search Box", "UniversalSearchBand") + and role == controlTypes.Role.PANE + and isinstance(obj, IAccessible) + ): + clsList.insert(0, SearchBoxClient) + return # Optimization: return early to avoid comparing class names and roles that will never match. + if windowClass == "ToolbarWindow32": if role != controlTypes.Role.POPUPMENU: try: