[orca] Improve heuristic to identify elements serving as fake placeholder for text
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Improve heuristic to identify elements serving as fake placeholder for text
- Date: Mon, 4 May 2020 19:19:55 +0000 (UTC)
commit 972b22385a199df9a71fcbe1233bf6a7976ff81b
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon May 4 15:12:12 2020 -0400
Improve heuristic to identify elements serving as fake placeholder for text
We want to treat fake placeholders for fake inputs like placeholders and
not confuse them for editable content in a contenteditable. The existing
heuristic was working for Firefox, but not for Chromium due to extra divs
being included in the accessibility tree and also text leaf nodes being
incorrectly treated as editable text elements.
src/orca/scripts/web/script_utilities.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 9cdbf45f1..45c021d51 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -3492,7 +3492,8 @@ class Utilities(script_utilities.Utilities):
if not (obj and self.inDocumentContent(obj) and obj.parent):
return False
- if not (obj.parent.getRole() == pyatspi.ROLE_ENTRY and obj.parent.name):
+ entry = pyatspi.findAncestor(obj, lambda x: x and x.getRole() == pyatspi.ROLE_ENTRY)
+ if not (entry and entry.name):
return False
def _isMatch(x):
@@ -3501,7 +3502,7 @@ class Utilities(script_utilities.Utilities):
string = x.queryText().getText(0, -1).strip()
except:
return False
- return role in [pyatspi.ROLE_SECTION, pyatspi.ROLE_STATIC] and obj.parent.name == string
+ return role in [pyatspi.ROLE_SECTION, pyatspi.ROLE_STATIC] and entry.name == string
if _isMatch(obj):
return True
@@ -4290,7 +4291,7 @@ class Utilities(script_utilities.Utilities):
return rv
hasTextBlockRole = lambda x: x and x.getRole() in self._textBlockElementRoles() \
- and not self.isFakePlaceholderForEntry(x)
+ and not self.isFakePlaceholderForEntry(x) and not self.isStaticTextLeaf(x)
if self._getTag(obj) in ["input", "textarea"]:
rv = False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]