Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialogs in web pages in Firefox and Chrome now get browseMode if the parent document also has browseMode #7433

Merged
merged 6 commits into from
Aug 29, 2017
2 changes: 1 addition & 1 deletion nvdaHelper/vbufBackends/mshtml/mshtml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ if(!(formatState&FORMATSTATE_INSERTED)&&nodeName.compare(L"INS")==0) {
// Whether the name is the content of this node.
bool nameIsContent = (IARole == ROLE_SYSTEM_LINK || IARole == ROLE_SYSTEM_PUSHBUTTON || IARole == ROLE_SYSTEM_MENUITEM || IARole == ROLE_SYSTEM_GRAPHIC || IARole == ROLE_SYSTEM_PAGETAB
|| ariaRole == L"heading" || (nodeName[0] == L'H' && iswdigit(nodeName[1]))
|| nodeName == L"OBJECT" || nodeName == L"APPLET" || IARole == ROLE_SYSTEM_APPLICATION || IARole == ROLE_SYSTEM_DIALOG);
|| nodeName == L"OBJECT" || nodeName == L"APPLET" || (!isRoot && (IARole == ROLE_SYSTEM_APPLICATION || IARole == ROLE_SYSTEM_DIALOG)));
// True if the name definitely came from the author.
bool nameFromAuthor=false;

Expand Down
9 changes: 5 additions & 4 deletions source/NVDAObjects/IAccessible/ia2Web.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import IAccessibleHandler
import controlTypes
from logHandler import log
from NVDAObjects.behaviors import Dialog
from NVDAObjects.behaviors import Dialog, WebDialog
from . import IAccessible
from .ia2TextMozilla import MozillaCompoundTextInfo

Expand Down Expand Up @@ -102,10 +102,11 @@ def findExtraOverlayClasses(obj, clsList, baseClass=Ia2Web, documentClass=None):
elif iaRole == oleacc.ROLE_SYSTEM_EQUATION:
clsList.append(Math)

isApp = iaRole in (oleacc.ROLE_SYSTEM_APPLICATION, oleacc.ROLE_SYSTEM_DIALOG)
if isApp:
if iaRole==oleacc.ROLE_SYSTEM_APPLICATION:
clsList.append(Application)
if isApp or iaRole == oleacc.ROLE_SYSTEM_DOCUMENT:
elif iaRole==oleacc.ROLE_SYSTEM_DIALOG:
clsList.append(WebDialog)
if iaRole in (oleacc.ROLE_SYSTEM_APPLICATION,oleacc.ROLE_SYSTEM_DIALOG,oleacc.ROLE_SYSTEM_DOCUMENT):
clsList.append(documentClass)

if obj.IA2States & IAccessibleHandler.IA2_STATE_EDITABLE:
Expand Down
11 changes: 11 additions & 0 deletions source/NVDAObjects/behaviors.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,3 +660,14 @@ def event_suggestionsClosed(self):
"""
if config.conf["presentation"]["reportAutoSuggestionsWithSound"]:
nvwave.playWaveFile(r"waves\suggestionsClosed.wav")

class WebDialog(NVDAObject):
"""
A dialog that will use a treeInterceptor if its parent currently does.
This can be used to ensure that dialogs on the web get browseMode by default, unless inside an ARIA application
"""

def _get_shouldCreateTreeInterceptor(self):
if self.parent.treeInterceptor:
return True
return False
4 changes: 2 additions & 2 deletions source/virtualBuffers/MSHTML.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ class MSHTML(VirtualBuffer):
def __init__(self,rootNVDAObject):
super(MSHTML,self).__init__(rootNVDAObject,backendName="mshtml")
# As virtualBuffers must be created at all times for MSHTML to support live regions,
# Force focus mode for anything other than a document (e.g. dialog, application)
if rootNVDAObject.role!=controlTypes.ROLE_DOCUMENT:
# Force focus mode for applications, and dialogs with no parent treeInterceptor (E.g. a dialog embedded in an application)
if rootNVDAObject.role==controlTypes.ROLE_APPLICATION or (rootNVDAObject.role==controlTypes.ROLE_DIALOG and (not rootNVDAObject.parent or not rootNVDAObject.parent.treeInterceptor or rootNVDAObject.parent.treeInterceptor.passThrough)):
self.disableAutoPassThrough=True
self.passThrough=True

Expand Down