[orca] Be more aggressive trying to set the caret offset in text
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Be more aggressive trying to set the caret offset in text
- Date: Tue, 23 Jul 2019 15:16:58 +0000 (UTC)
commit 04a68a7f86ad627109665ea2405226c9188168fe
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Jul 23 11:14:49 2019 -0400
Be more aggressive trying to set the caret offset in text
We do this to try to trigger a user-agent update of the focused element.
Of course, the user agents can (and do sometimes) ignore us. But at
least now we've tried....
src/orca/scripts/web/script_utilities.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index e19f50564..f0ced1a51 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -406,9 +406,16 @@ class Utilities(script_utilities.Utilities):
if grabFocus:
self.grabFocus(obj)
- text = self.queryNonEmptyText(obj)
- if text:
- text.setCaretOffset(offset)
+ # Don't use queryNonEmptyText() because we need to try to force-update focus.
+ if "Text" in pyatspi.listInterfaces(obj):
+ try:
+ obj.queryText().setCaretOffset(offset)
+ except:
+ msg = "WEB: Exception setting caret to %i in %s" % (offset, obj)
+ debug.println(debug.LEVEL_INFO, msg, True)
+ else:
+ msg = "WEB: Caret set to %i in %s" % (offset, obj)
+ debug.println(debug.LEVEL_INFO, msg, True)
if self._script.useFocusMode(obj) != self._script.inFocusMode():
self._script.togglePresentationMode(None)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]