[orca] Web: Handle caret-moved event preceding focus event when Tab pressed in entry
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Web: Handle caret-moved event preceding focus event when Tab pressed in entry
- Date: Wed, 3 Feb 2021 16:00:19 +0000 (UTC)
commit 180f03dd8cfb61f49574b001888843ee4744793e
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Feb 3 16:54:49 2021 +0100
Web: Handle caret-moved event preceding focus event when Tab pressed in entry
Chrome/Chromium appears to be emitting a caret-moved event before the
focus event the first time a new input/entry gains focus as a result
of tabbing into it. When this occurs, we update the locusOfFocus but
wind up presenting nothing because tabbing into editable text is not
a case handled by the default script.
In this particular case, we know that we will be getting a focus
event from the browser (and if we don't, we need that fixed in the
browser). So it's safe to ignore this initial caret-moved event and
wait for the focus event to do the presentation.
src/orca/scripts/web/script.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index a2630de43..bb3130861 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1589,10 +1589,18 @@ class Script(default.Script):
self.updateBraille(event.source)
return True
- if self.utilities.lastInputEventWasTab() and self.utilities.isDocument(event.source):
- msg = "WEB: Event ignored: Caret moved in document due to Tab."
- debug.println(debug.LEVEL_INFO, msg, True)
- return True
+ if self.utilities.lastInputEventWasTab():
+ if self.utilities.isDocument(event.source):
+ msg = "WEB: Event ignored: Caret moved in document due to Tab."
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return True
+
+ if event.source.getRole() == pyatspi.ROLE_ENTRY \
+ and event.source.getState().contains(pyatspi.STATE_FOCUSED) \
+ and event.source != orca_state.locusOfFocus:
+ msg = "WEB: Event ignored: Entry is not (yet) the locus of focus. Waiting for focus event."
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return True
if self.utilities.inFindContainer():
msg = "WEB: Event handled: Presenting find results"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]