[orca] Explicitly clear text selection when controlling navigation in web content
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Explicitly clear text selection when controlling navigation in web content
- Date: Fri, 19 Apr 2019 17:51:41 +0000 (UTC)
commit 4e365b7184ba392b59314b112df69810ad5f4fd6
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri Apr 19 13:50:17 2019 -0400
Explicitly clear text selection when controlling navigation in web content
src/orca/script_utilities.py | 5 ++---
src/orca/scripts/web/script_utilities.py | 9 +++++++++
2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 187867647..832c69692 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2634,8 +2634,7 @@ class Utilities:
return offset
- @staticmethod
- def clearTextSelection(obj):
+ def clearTextSelection(self, obj):
"""Clears the text selection if the object supports it.
Arguments:
@@ -2648,7 +2647,7 @@ class Utilities:
return
for i in range(text.getNSelections()):
- text.removeSelection(0)
+ text.removeSelection(i)
def expandEOCs(self, obj, startOffset=0, endOffset=-1):
"""Expands the current object replacing EMBEDDED_OBJECT_CHARACTERS
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 85155c1b3..37ab493d9 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -385,6 +385,7 @@ class Utilities(script_utilities.Utilities):
if self._script.focusModeIsSticky():
return
+ self.clearTextSelection(orca_state.locusOfFocus)
orca.setLocusOfFocus(None, obj, notifyScript=False)
if grabFocus:
self.grabFocus(obj)
@@ -3662,6 +3663,14 @@ class Utilities(script_utilities.Utilities):
return rv
+ def clearTextSelection(self, obj):
+ super().clearTextSelection(obj)
+ if self.isDocument(obj):
+ return
+
+ for child in obj:
+ self.clearTextSelection(child)
+
def clearCaretContext(self, documentFrame=None):
self.clearContentCache()
documentFrame = documentFrame or self.documentFrame()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]