[orca] Web: Don't allow time element or role to be parsed as sentences
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Web: Don't allow time element or role to be parsed as sentences
- Date: Thu, 30 Jun 2022 16:32:35 +0000 (UTC)
commit 13b38b1b95b68725c09b89722a2d0cf97b736d50
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Thu Jun 30 18:25:40 2022 +0200
Web: Don't allow time element or role to be parsed as sentences
Because the time element has various punctuation marks in it, user
agents sometimes expose it as being divided into multiple sentences.
Given a time element inside of a link while doing a SayAll by
sentence, we can theoretically repeat "link" after each substring
reported to us as a full sentence. Alternatively we might say "link"
only once, but somewhere in the middle rather than at the end.
This commit solves that problem by always treating the time element
as a single sentence, rather than asking user agents for its sentences.
Fixes issue #247
src/orca/scripts/web/script_utilities.py | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 2d80fc20d..c2f77f380 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1412,6 +1412,11 @@ class Utilities(script_utilities.Utilities):
if not obj:
return []
+ if boundary == pyatspi.TEXT_BOUNDARY_SENTENCE_START and self.isTime(obj):
+ text = self.queryNonEmptyText(obj)
+ if text:
+ return [[obj, 0, text.characterCount, text.getText(0, -1)]]
+
if boundary == pyatspi.TEXT_BOUNDARY_LINE_START:
if self.isMath(obj):
if self.isMathTopLevel(obj):
@@ -3117,6 +3122,9 @@ class Utilities(script_utilities.Utilities):
self._isNavigableToolTipDescendant[hash(obj)] = rv
return rv
+ def isTime(self, obj):
+ return 'time' in self._getXMLRoles(obj) or 'time' == self._getTag(obj)
+
def isToolBarDescendant(self, obj):
if not obj:
return False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]