[orca] Fix and improve alert presentation for Thunderbird and Firefox
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix and improve alert presentation for Thunderbird and Firefox
- Date: Mon, 11 Nov 2013 22:39:45 +0000 (UTC)
commit 846fe772c7ca013fbc78dc39137c9243ac37fd0c
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Nov 11 17:38:26 2013 -0500
Fix and improve alert presentation for Thunderbird and Firefox
src/orca/scripts/toolkits/Gecko/script.py | 52 +++++++++++++++++++++-------
1 files changed, 39 insertions(+), 13 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index a90502d..3bb0d91 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -1099,6 +1099,21 @@ class Script(default.Script):
default.Script.onTextSelectionChanged(self, event)
+ def onActiveChanged(self, event):
+ """Callback for object:state-changed:active accessibility events."""
+
+ if self.findCommandRun:
+ self.findCommandRun = False
+ self.find()
+ return
+
+ if not event.detail1:
+ return
+
+ role = event.source.getRole()
+ if role in [pyatspi.ROLE_DIALOG, pyatspi.ROLE_ALERT]:
+ orca.setLocusOfFocus(event, event.source)
+
def onBusyChanged(self, event):
"""Callback for object:state-changed:busy accessibility events."""
@@ -1281,13 +1296,20 @@ class Script(default.Script):
def onFocusedChanged(self, event):
"""Callback for object:state-changed:focused accessibility events."""
- # TODO - JD: Go through all of the crap below. :-/
+ if not event.detail1:
+ return
try:
eventSourceRole = event.source.getRole()
except:
return
+ if eventSourceRole in [pyatspi.ROLE_DIALOG, pyatspi.ROLE_ALERT]:
+ orca.setLocusOfFocus(event, event.source)
+ return
+
+ # TODO - JD: Go through all of the crap below. :-/
+
# Ignore events on the frame as they are often intermingled
# with menu activity, wreaking havoc on the context. We will
# ignore autocompletes because we get focus events for the
@@ -1351,18 +1373,6 @@ class Script(default.Script):
if not self.utilities.isSameObject(
obj, orca_state.locusOfFocus):
orca.setLocusOfFocus(event, obj, notifyScript=False)
- # If an alert got focus, let's do the best we can to
- # try to automatically speak its contents while also
- # making sure the locus of focus and caret context
- # are in the right spot for braille and caret navigation.
- # http://bugzilla.gnome.org/show_bug.cgi?id=570551
- #
- if eventSourceRole == pyatspi.ROLE_ALERT:
- speech.speak(self.speechGenerator.generateSpeech(
- event.source))
- self.updateBraille(obj)
- else:
- self.presentLine(obj, characterOffset)
return
default.Script.onFocusedChanged(self, event)
@@ -2171,6 +2181,22 @@ class Script(default.Script):
except:
pass
obj = obj or orca_state.locusOfFocus
+
+ # TODO - JD: It seems insufficient to take a "if it's ARIA, use
+ # the default script" approach. For instance, an ARIA dialog does
+ # not have "unrelated labels"; it has embedded object characters
+ # just like other Gecko content. Unless and until Gecko exposes
+ # ARIA widgets as proper widgets, we'll need to not be so trusting.
+ # For now, just add hacks on a per-case basis until there is time
+ # to properly review this code.
+ try:
+ role = obj.getRole()
+ except:
+ pass
+ else:
+ if role in [pyatspi.ROLE_DIALOG, pyatspi.ROLE_ALERT]:
+ return False
+
attrs = self._getAttrDictionary(obj)
if 'isAria' not in self.generatorCache:
self.generatorCache['isAria'] = {}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]