[orca] Present text changes resulting from onclick handlers
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Present text changes resulting from onclick handlers
- Date: Tue, 20 Oct 2015 16:19:25 +0000 (UTC)
commit b27779a5073b1e215c55b64fdee1cecbbeb95850
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Oct 20 12:15:42 2015 -0400
Present text changes resulting from onclick handlers
src/orca/orca_gui_navlist.py | 1 +
src/orca/scripts/web/script.py | 16 ++++--
test/html/clickable-text-change.html | 16 +++++
.../html_struct_nav_clickable_text_change.params | 1 +
.../html_struct_nav_clickable_text_change.py | 60 ++++++++++++++++++++
5 files changed, 89 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/orca_gui_navlist.py b/src/orca/orca_gui_navlist.py
index 4b31b8e..60ab327 100644
--- a/src/orca/orca_gui_navlist.py
+++ b/src/orca/orca_gui_navlist.py
@@ -141,6 +141,7 @@ class OrcaNavListGUI:
def _onActivateClicked(self, widget):
obj, offset = self._getSelectedAccessibleAndOffset()
self._gui.destroy()
+ self._script.utilities.setCaretPosition(obj, offset)
try:
action = obj.queryAction()
except:
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index cee5860..73a4c10 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1632,11 +1632,17 @@ class Script(default.Script):
return True
state = event.source.getState()
- if not state.contains(pyatspi.STATE_EDITABLE) \
- and event.source != orca_state.locusOfFocus:
- msg = "WEB: Done processing non-editable, non-locusOfFocus source"
- debug.println(debug.LEVEL_INFO, msg)
- return True
+ if not state.contains(pyatspi.STATE_EDITABLE):
+ if event.source != orca_state.locusOfFocus:
+ msg = "WEB: Done processing non-editable, non-locusOfFocus source"
+ debug.println(debug.LEVEL_INFO, msg)
+ return True
+
+ if self.utilities.isClickableElement(event.source):
+ msg = "WEB: Event handled: Re-setting locusOfFocus to changed clickable"
+ debug.println(debug.LEVEL_INFO, msg)
+ orca.setLocusOfFocus(None, event.source, force=True)
+ return True
return False
diff --git a/test/html/clickable-text-change.html b/test/html/clickable-text-change.html
new file mode 100644
index 0000000..d1e8f7a
--- /dev/null
+++ b/test/html/clickable-text-change.html
@@ -0,0 +1,16 @@
+<html>
+<head></head>
+<body>
+<script type="text/javascript">
+function changeText(e) {
+ if(e.textContent == "Hello")
+ e.textContent = "Goodbye cruel";
+ else
+ e.textContent = "Hello";
+ }
+</script>
+<div>Line 1</div>
+<div><span onclick="changeText(this)">Hello</span> world!</div>
+<div>Line 3</div>
+</body>
+</html>
diff --git a/test/keystrokes/firefox/html_struct_nav_clickable_text_change.params
b/test/keystrokes/firefox/html_struct_nav_clickable_text_change.params
new file mode 100644
index 0000000..4c492a4
--- /dev/null
+++ b/test/keystrokes/firefox/html_struct_nav_clickable_text_change.params
@@ -0,0 +1 @@
+PARAMS=$TEST_DIR/../../html/clickable-text-change.html
diff --git a/test/keystrokes/firefox/html_struct_nav_clickable_text_change.py
b/test/keystrokes/firefox/html_struct_nav_clickable_text_change.py
new file mode 100644
index 0000000..bf34424
--- /dev/null
+++ b/test/keystrokes/firefox/html_struct_nav_clickable_text_change.py
@@ -0,0 +1,60 @@
+#!/usr/bin/python
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+sequence.append(WaitForDocLoad())
+
+# 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(KeyComboAction("<Control>Home"))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("a"))
+sequence.append(utils.AssertPresentationAction(
+ "1. a for next clickable",
+ ["BRAILLE LINE: 'Hello'",
+ " VISIBLE: 'Hello', cursor=1",
+ "SPEECH OUTPUT: 'Hello clickable'"]))
+
+sequence.append(PauseAction(5000))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("KP_Divide"))
+sequence.append(PauseAction(5000))
+sequence.append(utils.AssertPresentationAction(
+ "2. KP_Divide to click on clickable",
+ ["BRAILLE LINE: 'Goodbye cruel'",
+ " VISIBLE: 'Goodbye cruel', cursor=1",
+ "SPEECH OUTPUT: 'Goodbye cruel clickable'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Alt><Shift>a"))
+sequence.append(PauseAction(5000))
+sequence.append(utils.AssertPresentationAction(
+ "3. Alt+a for Activate button",
+ ["BRAILLE LINE: 'runorca.py application Clickables: 1 item found dialog'",
+ " VISIBLE: 'Clickables: 1 item found dialog', cursor=1",
+ "BRAILLE LINE: 'runorca.py application Clickables: 1 item found dialog table Clickable column header
Goodbye cruel static'",
+ " VISIBLE: 'Goodbye cruel static', cursor=1",
+ "SPEECH OUTPUT: 'Clickables: 1 item found'",
+ "SPEECH OUTPUT: 'table with 1 row 2 columns'",
+ "SPEECH OUTPUT: 'Goodbye cruel static.'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Alt>a"))
+sequence.append(PauseAction(5000))
+sequence.append(utils.AssertPresentationAction(
+ "4. Alt+a for Activate button",
+ ["BRAILLE LINE: 'Firefox application Nightly frame'",
+ " VISIBLE: 'Nightly frame', cursor=1",
+ "BRAILLE LINE: 'Goodbye cruel'",
+ " VISIBLE: 'Goodbye cruel', cursor=1",
+ "SPEECH OUTPUT: 'Nightly frame'",
+ "SPEECH OUTPUT: 'Hello clickable'"]))
+
+sequence.append(utils.AssertionSummaryAction())
+sequence.start()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]