[orca] Fix issue presenting focus changes between document frame and child link
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix issue presenting focus changes between document frame and child link
- Date: Mon, 25 May 2015 22:16:41 +0000 (UTC)
commit 9e63577932cd5bdc013999a85ba7af0b62929204
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon May 25 18:14:52 2015 -0400
Fix issue presenting focus changes between document frame and child link
src/orca/formatting.py | 2 +-
src/orca/scripts/toolkits/Gecko/script.py | 21 +++++-----
test/html/link-child-of-body.html | 6 +++
.../focus_tracking_link_child_of_body.params | 1 +
.../firefox/focus_tracking_link_child_of_body.py | 41 ++++++++++++++++++++
5 files changed, 60 insertions(+), 11 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index b19791f..1bea425 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -148,7 +148,7 @@ formatting = {
'unfocused': 'expandedEOCs or (labelOrName + unrelatedLabels)'
},
pyatspi.ROLE_DOCUMENT_FRAME: {
- 'unfocused': 'label + readOnly + textRole + textContent + anyTextSelection + ' + MNEMONIC,
+ 'unfocused': 'label + readOnly + textRole + currentLineText + anyTextSelection + ' + MNEMONIC,
'basicWhereAmI': 'label + readOnly + textRole + textContent + anyTextSelection + ' + MNEMONIC,
'detailedWhereAmI': 'label + readOnly + textRole + textContentWithAttributes + anyTextSelection
+ ' + MNEMONIC + ' + ' + TUTORIAL
},
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 273051d..b589391 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -1295,12 +1295,6 @@ class Script(default.Script):
return True
if role in [pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_DOCUMENT_WEB]:
- if self.inDocumentContent(orca_state.locusOfFocus) \
- and not self.utilities.isZombie(orca_state.locusOfFocus):
- msg = "INFO: Event ignored: locusOfFocus already in document"
- debug.println(debug.LEVEL_INFO, msg)
- return True
-
obj, offset = self.getCaretContext(event.source)
if obj and self.utilities.isZombie(obj):
msg = "INFO: Clearing context - obj is zombie"
@@ -1309,10 +1303,14 @@ class Script(default.Script):
obj, offset = self.getCaretContext(event.source)
if obj:
- msg = "INFO: Event handled: Setting locusOfFocus to context"
- debug.println(debug.LEVEL_INFO, msg)
- orca.setLocusOfFocus(event, obj)
- return True
+ wasFocused = obj.getState().contains(pyatspi.STATE_FOCUSED)
+ obj.clearCache()
+ isFocused = obj.getState().contains(pyatspi.STATE_FOCUSED)
+ if wasFocused == isFocused:
+ msg = "INFO: Event handled: Setting locusOfFocus to context"
+ debug.println(debug.LEVEL_INFO, msg)
+ orca.setLocusOfFocus(event, obj)
+ return True
if not state.contains(pyatspi.STATE_FOCUSABLE) \
and not state.contains(pyatspi.STATE_FOCUSED):
@@ -1543,6 +1541,9 @@ class Script(default.Script):
super().locusOfFocusChanged(event, oldFocus, newFocus)
return False
+ if oldFocus and self.utilities.isZombie(oldFocus):
+ oldFocus = None
+
caretOffset = 0
if self.utilities.inFindToolbar(oldFocus):
newFocus, caretOffset = self.getCaretContext()
diff --git a/test/html/link-child-of-body.html b/test/html/link-child-of-body.html
new file mode 100644
index 0000000..090adfd
--- /dev/null
+++ b/test/html/link-child-of-body.html
@@ -0,0 +1,6 @@
+<html>
+<head></head>
+<body>
+<a href="foo.html">Foo</a>
+</body>
+</html>
diff --git a/test/keystrokes/firefox/focus_tracking_link_child_of_body.params
b/test/keystrokes/firefox/focus_tracking_link_child_of_body.params
new file mode 100644
index 0000000..208f011
--- /dev/null
+++ b/test/keystrokes/firefox/focus_tracking_link_child_of_body.params
@@ -0,0 +1 @@
+PARAMS=$TEST_DIR/../../html/link-child-of-body.html
diff --git a/test/keystrokes/firefox/focus_tracking_link_child_of_body.py
b/test/keystrokes/firefox/focus_tracking_link_child_of_body.py
new file mode 100644
index 0000000..02d7b12
--- /dev/null
+++ b/test/keystrokes/firefox/focus_tracking_link_child_of_body.py
@@ -0,0 +1,41 @@
+#!/usr/bin/python
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+# Work around some new quirk in Gecko that causes this test to fail if
+# run via the test harness rather than manually.
+sequence.append(KeyComboAction("<Control>r"))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Home"))
+sequence.append(utils.AssertPresentationAction(
+ "1. Top of file",
+ ["BRAILLE LINE: 'Foo'",
+ " VISIBLE: 'Foo', cursor=1",
+ "SPEECH OUTPUT: 'Foo'",
+ "SPEECH OUTPUT: 'link'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Shift>Tab"))
+sequence.append(utils.AssertPresentationAction(
+ "2. Shift Tab",
+ ["KNOWN ISSUE: Extra 'F' in the braille.",
+ "BRAILLE LINE: 'F Foo'",
+ " VISIBLE: 'F Foo', cursor=0",
+ "SPEECH OUTPUT: 'document frame'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Tab"))
+sequence.append(utils.AssertPresentationAction(
+ "3. Tab",
+ ["BRAILLE LINE: 'F Foo'",
+ " VISIBLE: 'F Foo', cursor=1",
+ "BRAILLE LINE: 'F Foo'",
+ " VISIBLE: 'F Foo', cursor=1",
+ "SPEECH OUTPUT: 'Foo link'"]))
+
+sequence.append(utils.AssertionSummaryAction())
+sequence.start()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]