[orca] Chromium: Present alerts upon window activation



commit 6606255fdd3bfbdab388532a4713c68e13a9432f
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Mon Jan 20 12:13:25 2020 -0500

    Chromium: Present alerts upon window activation
    
    Chromium (currently) doesn't emit accessibility events when alerts are
    displayed upon window activation. So check for them and present any that
    are found.
    
    Note: Chromium also does not (yet) apply the correct role to alerts,
    such as the retore-pages alert. Until that is fixed in Chromium,
    Orca still won't present these alerts.

 src/orca/scripts/toolkits/Chromium/script.py | 7 +++++++
 src/orca/scripts/web/script.py               | 5 ++---
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Chromium/script.py b/src/orca/scripts/toolkits/Chromium/script.py
index 5326ce507..6baa54bb9 100644
--- a/src/orca/scripts/toolkits/Chromium/script.py
+++ b/src/orca/scripts/toolkits/Chromium/script.py
@@ -380,6 +380,13 @@ class Script(web.Script):
         debug.println(debug.LEVEL_INFO, msg, True)
         default.Script.onWindowActivated(self, event)
 
+        # Right now we don't get accessibility events for alerts which are
+        # already showing at the time of window activation. If that changes,
+        # we should store presented alerts so we don't double-present them.
+        for child in event.source:
+            if child.getRole() == pyatspi.ROLE_ALERT:
+                self.presentObject(child)
+
     def onWindowDeactivated(self, event):
         """Callback for window:deactivate accessibility events."""
 
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 4d32d5d62..1c83b3a92 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -2191,10 +2191,9 @@ class Script(default.Script):
     def onWindowActivated(self, event):
         """Callback for window:activate accessibility events."""
 
-        msg = "WEB: Calling default onWindowActivated"
+        msg = "WEB: Deferring to app/toolkit script"
         debug.println(debug.LEVEL_INFO, msg, True)
-        super().onWindowActivated(event)
-        return True
+        return False
 
     def onWindowDeactivated(self, event):
         """Callback for window:deactivate accessibility events."""


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]