[orca] Prevent skip links which appear above banners from being treated on same line



commit 03a823929d054fb373a6aeac34bd8f8bb9055ece
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Feb 17 21:28:46 2020 +0100

    Prevent skip links which appear above banners from being treated on same line
    
    When a site has a skip link which appears above a banner, it can shove the
    elements in the banner down. Unfortunately, this doesn't cause the user
    agents to give us the updated bounding boxes. As a result, it seems like
    the skip link is on the same line as the repositioned banner. In order to
    try to catch this condition, check links for banner ancestors and treat
    them as if they are on a different line if one link is in a banner and the
    other is not.

 src/orca/scripts/web/script_utilities.py | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index ce33bfcb3..6a5454df9 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1539,6 +1539,8 @@ class Utilities(script_utilities.Utilities):
             if container:
                 extents = self.getExtents(container, 0, 1)
 
+        objBanner = pyatspi.findAncestor(obj, self.isLandmarkBanner)
+
         def _include(x):
             if x in objects:
                 return False
@@ -1553,6 +1555,9 @@ class Utilities(script_utilities.Utilities):
                 if self.isLandmark(obj) and self.isLandmark(xObj):
                     return False
                 if self.isLink(obj) and self.isLink(xObj):
+                    xObjBanner =  pyatspi.findAncestor(xObj, self.isLandmarkBanner)
+                    if (objBanner or xObjBanner) and objBanner != xObjBanner:
+                        return False
                     if abs(extents[0] - xExtents[0]) <= 1 and abs(extents[1] - xExtents[1]) <= 1:
                         # This happens with dynamic skip links such as found on Wikipedia.
                         return False


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