Skip to content

Commit

Permalink
Move WebDialog into behaviors and add more detail to docstring.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelDCurran committed Aug 1, 2017
1 parent eff34ca commit 6960f54
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
17 changes: 1 addition & 16 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, FocusableUnfocusableContainer
from NVDAObjects.behaviors import Dialog, WebDialog
from . import IAccessible
from .ia2TextMozilla import MozillaCompoundTextInfo

Expand Down Expand Up @@ -46,21 +46,6 @@ def _get_shouldCreateTreeInterceptor(self):
class Application(Document):
shouldCreateTreeInterceptor = False

class WebDialog(Document):
"""
A dialog that will use a treeInterceptor if its parent currently does.
"""

def _get_shouldCreateTreeInterceptor(self):
if self.parent.treeInterceptor:
return True
return False

# For dialogs that will get browseMode and are focusable themselves (have a tabindex):
# Allow setting focus to the dialog directly, rather than its first focusable descendant
def _get__alwaysFocusFirstfocusableDescendant(self):
return not self.shouldCreateTreeInterceptor

class BlockQuote(Ia2Web):
role = controlTypes.ROLE_BLOCKQUOTE

Expand Down
14 changes: 11 additions & 3 deletions source/NVDAObjects/behaviors.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,9 +603,6 @@ class FocusableUnfocusableContainer(NVDAObject):
isFocusable = True

def setFocus(self):
# provide a way for sub or super classes to disable this focusable descendant behaviour if necessary.
if not getattr(self,'_alwaysFocusFirstfocusableDescendant',True) and super(FocusableUnfocusableContainer,self).isFocusable:
return super(FocusableUnfocusableContainer,self).setFocus()
for obj in self.recursiveDescendants:
if obj.isFocusable:
obj.setFocus()
Expand Down Expand Up @@ -663,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

0 comments on commit 6960f54

Please sign in to comment.