Skip to content

Commit

Permalink
Quick nav: tab headers as form fields (PR #10438)
Browse files Browse the repository at this point in the history
Fixes #10432
  • Loading branch information
JulienCochuyt authored Oct 13, 2020
1 parent 8e17d44 commit 3abcc51
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 27 deletions.
34 changes: 26 additions & 8 deletions source/UIABrowseMode.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2015-2017 NV Access Limited, Babbage B.V.
# A part of NonVisual Desktop Access (NVDA)
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
# Copyright (C) 2015-2020 NV Access Limited, Babbage B.V., Accessolutions, Julien Cochuyt

from ctypes import byref
from comtypes import COMError
Expand All @@ -11,10 +11,10 @@
import UIAHandler
from UIAUtils import (
createUIAMultiPropertyCondition,
isUIAElementInWalker,
getDeepestLastChildUIAElementInWalker,
getUIATextAttributeValueFromRange,
iterUIARangeByUnit
isUIAElementInWalker,
iterUIARangeByUnit,
)
import documentBase
import treeInterceptorHandler
Expand Down Expand Up @@ -417,8 +417,26 @@ def _iterNodesByType(self,nodeType,direction="next",pos=None):
condition=createUIAMultiPropertyCondition({UIAHandler.UIA_ControlTypePropertyId:UIAHandler.UIA_EditControlTypeId,UIAHandler.UIA_ValueIsReadOnlyPropertyId:False},{UIAHandler.UIA_ControlTypePropertyId:UIAHandler.UIA_ComboBoxControlTypeId,UIAHandler.UIA_IsTextPatternAvailablePropertyId:True})
return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction)
elif nodeType=="formField":
condition=createUIAMultiPropertyCondition({UIAHandler.UIA_ControlTypePropertyId:UIAHandler.UIA_EditControlTypeId,UIAHandler.UIA_ValueIsReadOnlyPropertyId:False},{UIAHandler.UIA_ControlTypePropertyId:UIAHandler.UIA_ListControlTypeId,UIAHandler.UIA_IsKeyboardFocusablePropertyId:True},{UIAHandler.UIA_ControlTypePropertyId:[UIAHandler.UIA_CheckBoxControlTypeId,UIAHandler.UIA_RadioButtonControlTypeId,UIAHandler.UIA_ComboBoxControlTypeId,UIAHandler.UIA_ButtonControlTypeId]})
return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction)
condition = createUIAMultiPropertyCondition(
{
UIAHandler.UIA_ControlTypePropertyId: UIAHandler.UIA_EditControlTypeId,
UIAHandler.UIA_ValueIsReadOnlyPropertyId: False
},
{
UIAHandler.UIA_ControlTypePropertyId: UIAHandler.UIA_ListControlTypeId,
UIAHandler.UIA_IsKeyboardFocusablePropertyId: True
},
{
UIAHandler.UIA_ControlTypePropertyId: [
UIAHandler.UIA_ButtonControlTypeId,
UIAHandler.UIA_CheckBoxControlTypeId,
UIAHandler.UIA_ComboBoxControlTypeId,
UIAHandler.UIA_RadioButtonControlTypeId,
UIAHandler.UIA_TabItemControlTypeId,
]
},
)
return UIAControlQuicknavIterator(nodeType, self, pos, condition, direction)
elif nodeType == "landmark":
condition = UIAHandler.handler.clientObject.createNotCondition(
UIAHandler.handler.clientObject.createPropertyCondition(
Expand Down
37 changes: 26 additions & 11 deletions source/virtualBuffers/MSHTML.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#virtualBuffers/MSHTML.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2009-2017 NV Access Limited, Babbage B.V.
# virtualBuffers/MSHTML.py
# A part of NonVisual Desktop Access (NVDA)
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
# Copyright (C) 2009-2020 NV Access Limited, Babbage B.V., Accessolutions, Julien Cochuyt

from comtypes import COMError
import eventHandler
Expand Down Expand Up @@ -244,14 +244,29 @@ def _searchableAttribsForNodeType(self,nodeType):
attrs={"IAccessible::role":[oleacc.ROLE_SYSTEM_LINK],"IAccessible::state_%d"%oleacc.STATE_SYSTEM_LINKED:[1],"IAccessible::state_%d"%oleacc.STATE_SYSTEM_TRAVERSED:[None]}
elif nodeType=="formField":
attrs=[
{"IAccessible::role":[oleacc.ROLE_SYSTEM_PUSHBUTTON,oleacc.ROLE_SYSTEM_RADIOBUTTON,oleacc.ROLE_SYSTEM_CHECKBUTTON,oleacc.ROLE_SYSTEM_OUTLINE],"IAccessible::state_%s"%oleacc.STATE_SYSTEM_READONLY:[None]},
{"IAccessible::role":[oleacc.ROLE_SYSTEM_COMBOBOX]},
{
"IAccessible::role": [
oleacc.ROLE_SYSTEM_CHECKBUTTON,
oleacc.ROLE_SYSTEM_OUTLINE,
oleacc.ROLE_SYSTEM_PUSHBUTTON,
oleacc.ROLE_SYSTEM_PAGETAB,
oleacc.ROLE_SYSTEM_RADIOBUTTON,
],
f"IAccessible::state_{oleacc.STATE_SYSTEM_READONLY}": [None],
},
{"IAccessible::role": [oleacc.ROLE_SYSTEM_COMBOBOX]},
# Focusable edit fields (input type=text, including readonly ones)
{"IAccessible::role":[oleacc.ROLE_SYSTEM_TEXT],"IAccessible::state_%s"%oleacc.STATE_SYSTEM_FOCUSABLE:[1]},
{
"IAccessible::role": [oleacc.ROLE_SYSTEM_TEXT],
f"IAccessible::state_{oleacc.STATE_SYSTEM_FOCUSABLE}": [1],
},
# Any top-most content editable element (E.g. an editable div for rhich text editing)
{"IHTMLElement::isContentEditable":[1],"parent::IHTMLElement::isContentEditable":[0,None]},
{"IHTMLDOMNode::nodeName":["SELECT"]},
{"HTMLAttrib::role":["listbox"]},
{
"IHTMLElement::isContentEditable": [1],
"parent::IHTMLElement::isContentEditable": [0, None],
},
{"IHTMLDOMNode::nodeName": ["SELECT"]},
{"HTMLAttrib::role": ["listbox"]},
]
elif nodeType=="button":
attrs={"IAccessible::role":[oleacc.ROLE_SYSTEM_PUSHBUTTON]}
Expand Down
38 changes: 30 additions & 8 deletions source/virtualBuffers/gecko_ia2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#virtualBuffers/gecko_ia2.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
# Copyright (C) 2008-2020 NV Access Limited, Babbage B.V., Mozilla Corporation
# virtualBuffers/gecko_ia2.py
# A part of NonVisual Desktop Access (NVDA)
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
# Copyright (C) 2008-2020 NV Access Limited, Babbage B.V., Mozilla Corporation, Accessolutions, Julien Cochuyt

import weakref
from . import VirtualBuffer, VirtualBufferTextInfo, VBufStorage_findMatch_word, VBufStorage_findMatch_notEmpty
Expand Down Expand Up @@ -325,9 +325,31 @@ def _searchableAttribsForNodeType(self,nodeType):
attrs={"IAccessible::role":[oleacc.ROLE_SYSTEM_LINK],"IAccessible::state_%d"%oleacc.STATE_SYSTEM_LINKED:[1],"IAccessible::state_%d"%oleacc.STATE_SYSTEM_TRAVERSED:[None]}
elif nodeType=="formField":
attrs=[
{"IAccessible::role":[oleacc.ROLE_SYSTEM_PUSHBUTTON,oleacc.ROLE_SYSTEM_BUTTONMENU,oleacc.ROLE_SYSTEM_RADIOBUTTON,oleacc.ROLE_SYSTEM_CHECKBUTTON,oleacc.ROLE_SYSTEM_COMBOBOX,oleacc.ROLE_SYSTEM_LIST,oleacc.ROLE_SYSTEM_OUTLINE,IAccessibleHandler.IA2_ROLE_TOGGLE_BUTTON],"IAccessible::state_%s"%oleacc.STATE_SYSTEM_READONLY:[None]},
{"IAccessible::role":[oleacc.ROLE_SYSTEM_COMBOBOX,oleacc.ROLE_SYSTEM_TEXT],"IAccessible2::state_%s"%IAccessibleHandler.IA2_STATE_EDITABLE:[1]},
{"IAccessible2::state_%s"%IAccessibleHandler.IA2_STATE_EDITABLE:[1],"parent::IAccessible2::state_%s"%IAccessibleHandler.IA2_STATE_EDITABLE:[None]},
{
"IAccessible::role": [
oleacc.ROLE_SYSTEM_BUTTONMENU,
oleacc.ROLE_SYSTEM_CHECKBUTTON,
oleacc.ROLE_SYSTEM_COMBOBOX,
oleacc.ROLE_SYSTEM_LIST,
oleacc.ROLE_SYSTEM_OUTLINE,
oleacc.ROLE_SYSTEM_PUSHBUTTON,
oleacc.ROLE_SYSTEM_RADIOBUTTON,
oleacc.ROLE_SYSTEM_PAGETAB,
IAccessibleHandler.IA2_ROLE_TOGGLE_BUTTON,
],
f"IAccessible::state_{oleacc.STATE_SYSTEM_READONLY}": [None],
},
{
"IAccessible::role": [
oleacc.ROLE_SYSTEM_COMBOBOX,
oleacc.ROLE_SYSTEM_TEXT
],
f"IAccessible2::state_{IAccessibleHandler.IA2_STATE_EDITABLE}": [1],
},
{
f"IAccessible2::state_{IAccessibleHandler.IA2_STATE_EDITABLE}": [1],
f"parent::IAccessible2::state_{IAccessibleHandler.IA2_STATE_EDITABLE}": [None],
},
]
elif nodeType=="list":
attrs={"IAccessible::role":[oleacc.ROLE_SYSTEM_LIST]}
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ What's New in NVDA
- Users are now notified when attempting to create Speech Dictionary entries with invalid regular expression substitutions. (#11407)
- Specifically grouping errors are now detected.
- Added support for the new chinese Traditional Quick and Pinyin Input methods in Windows 10. (#11562)
- Tab headers are now considered form fields with quick navigation f key. (#10432)


== Changes ==
Expand Down

0 comments on commit 3abcc51

Please sign in to comment.