[orca] Don't include alerts from web browsers as unfocused alerts
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Don't include alerts from web browsers as unfocused alerts
- Date: Wed, 13 Nov 2019 18:46:25 +0000 (UTC)
commit bfa78111576aa365a6c2aa62ffdeed74bcd4ae93
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Nov 13 13:42:29 2019 -0500
Don't include alerts from web browsers as unfocused alerts
The alert role is used for things like Firefox door hangers. They are
almost always unfocused. For this reason, Orca automatically announces
alerts from web browsers even when they are not focused. Also including
these containers in the list of unfocused dialogs is too chatty.
src/orca/script_utilities.py | 8 +++++++-
src/orca/scripts/web/script_utilities.py | 3 +++
2 files changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 2bdf0d9b2..9d39bb96b 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2435,6 +2435,9 @@ class Utilities:
return sorted(labels, key=functools.cmp_to_key(self.spatialComparison))
+ def _treatAlertsAsDialogs(self):
+ return True
+
def unfocusedAlertAndDialogCount(self, obj):
"""If the current application has one or more alert or dialog
windows and the currently focused window is not an alert or a dialog,
@@ -2447,7 +2450,10 @@ class Utilities:
Returns the alert and dialog count.
"""
- roles = [pyatspi.ROLE_ALERT, pyatspi.ROLE_DIALOG]
+ roles = [pyatspi.ROLE_DIALOG]
+ if self._treatAlertsAsDialogs():
+ roles.append(pyatspi.ROLE_ALERT)
+
isDialog = lambda x: x and x.getRole() in roles or self.isFunctionalDialog(x)
dialogs = [x for x in obj.getApplication() if isDialog(x)]
dialogs.extend([x for x in self.topLevelObject(obj) if isDialog(x)])
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 8417b83f6..b7e70eda6 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2041,6 +2041,9 @@ class Utilities(script_utilities.Utilities):
return string, start, end
+ def _treatAlertsAsDialogs(self):
+ return False
+
def treatAsDiv(self, obj, offset=None):
if not (obj and self.inDocumentContent(obj)):
return False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]