[orca] Handle input type="number" (which aren't exposed like native spin buttons)
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Handle input type="number" (which aren't exposed like native spin buttons)
- Date: Tue, 28 Jul 2015 03:35:18 +0000 (UTC)
commit 6a32cd36ce7a6766ccc28f7d038927b37eb058fa
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Jul 27 23:31:44 2015 -0400
Handle input type="number" (which aren't exposed like native spin buttons)
src/orca/scripts/web/script.py | 17 ++++++
src/orca/scripts/web/script_utilities.py | 31 +++++++++++
test/html/input-type-number.html | 7 +++
.../focus_tracking_input_type_number.params | 1 +
.../firefox/focus_tracking_input_type_number.py | 54 ++++++++++++++++++++
5 files changed, 110 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 11ab839..5f8b05b 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1169,6 +1169,13 @@ class Script(default.Script):
self.utilities.setCaretContext(obj, offset)
return True
+ if self.utilities.treatEventAsSpinnerValueChange(event):
+ msg = "WEB: Event handled as the value-change event we wish we'd get"
+ debug.println(debug.LEVEL_INFO, msg)
+ self.updateBraille(event.source)
+ self._presentTextAtNewCaretPosition(event)
+ return True
+
if not _settingsManager.getSetting('caretNavigationEnabled') \
or self._inFocusMode or isEditable:
orca.setLocusOfFocus(event, event.source, False)
@@ -1441,6 +1448,11 @@ class Script(default.Script):
debug.println(debug.LEVEL_INFO, msg)
return True
+ if self.utilities.eventIsSpinnerNoise(event):
+ msg = "WEB: Ignoring: Event believed to be spinner noise"
+ debug.println(debug.LEVEL_INFO, msg)
+ return True
+
if self.utilities.textEventIsDueToInsertion(event):
msg = "WEB: Ignoring event believed to be due to text insertion"
debug.println(debug.LEVEL_INFO, msg)
@@ -1482,6 +1494,11 @@ class Script(default.Script):
debug.println(debug.LEVEL_INFO, msg)
return True
+ if self.utilities.eventIsSpinnerNoise(event):
+ msg = "WEB: Ignoring: Event believed to be spinner noise"
+ debug.println(debug.LEVEL_INFO, msg)
+ return True
+
# TODO - JD: As an experiment, we're stopping these at the event manager.
# If that works, this can be removed.
if self.utilities.eventIsEOCAdded(event):
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 5ad6b62..7522935 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1834,6 +1834,37 @@ class Utilities(script_utilities.Utilities):
return True
+ def isSpinnerEntry(self, obj):
+ if not self.inDocumentContent(obj):
+ return False
+
+ # TODO - JD: Ideally, things that look and act like spinners (such number inputs)
+ # would look and act like platform native spinners. That's not true for Gecko. And
+ # the only thing that's funkier is what we get from WebKitGtk. Try to at least get
+ # the two engines into alignment before migrating Epiphany support to the web script.
+ if obj.getState().contains(pyatspi.STATE_EDITABLE) \
+ and obj.parent.getRole() == pyatspi.ROLE_SPIN_BUTTON:
+ return True
+
+ return False
+
+ def eventIsSpinnerNoise(self, event):
+ if event.type.startswith("object:text-changed") and self.isSpinnerEntry(event.source):
+ lastKey, mods = self.lastKeyAndModifiers()
+ if lastKey in ["Down", "Up"]:
+ return True
+
+ return False
+
+ def treatEventAsSpinnerValueChange(self, event):
+ if event.type.startswith("object:text-caret-moved") and self.isSpinnerEntry(event.source):
+ lastKey, mods = self.lastKeyAndModifiers()
+ if lastKey in ["Down", "Up"]:
+ obj, offset = self.getCaretContext()
+ return event.source == obj
+
+ return False
+
def eventIsStatusBarNoise(self, event):
if self.inDocumentContent(event.source):
return False
diff --git a/test/html/input-type-number.html b/test/html/input-type-number.html
new file mode 100644
index 0000000..d148c4b
--- /dev/null
+++ b/test/html/input-type-number.html
@@ -0,0 +1,7 @@
+<html>
+<head></head>
+<body>
+<div>Input type="number": <input type="number" value="0" /></div>
+</body>
+</html>
+
diff --git a/test/keystrokes/firefox/focus_tracking_input_type_number.params
b/test/keystrokes/firefox/focus_tracking_input_type_number.params
new file mode 100644
index 0000000..89b2222
--- /dev/null
+++ b/test/keystrokes/firefox/focus_tracking_input_type_number.params
@@ -0,0 +1 @@
+PARAMS=$TEST_DIR/../../html/input-type-number.html
diff --git a/test/keystrokes/firefox/focus_tracking_input_type_number.py
b/test/keystrokes/firefox/focus_tracking_input_type_number.py
new file mode 100644
index 0000000..9b9cdb8
--- /dev/null
+++ b/test/keystrokes/firefox/focus_tracking_input_type_number.py
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+sequence.append(KeyComboAction("<Control>Home"))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Tab"))
+sequence.append(utils.AssertPresentationAction(
+ "1. Tab",
+ ["BRAILLE LINE: '0 $l'",
+ " VISIBLE: '0 $l', cursor=2",
+ "BRAILLE LINE: 'Focus mode'",
+ " VISIBLE: 'Focus mode', cursor=0",
+ "BRAILLE LINE: '0 $l'",
+ " VISIBLE: '0 $l', cursor=2",
+ "SPEECH OUTPUT: 'entry 0 selected'",
+ "SPEECH OUTPUT: 'Focus mode' voice=system"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "2. Down",
+ ["BRAILLE LINE: '-1 $l'",
+ " VISIBLE: '-1 $l', cursor=3",
+ "BRAILLE LINE: '-1 $l'",
+ " VISIBLE: '-1 $l', cursor=3",
+ "SPEECH OUTPUT: '-1'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "3. Down",
+ ["BRAILLE LINE: '-2 $l'",
+ " VISIBLE: '-2 $l', cursor=3",
+ "BRAILLE LINE: '-2 $l'",
+ " VISIBLE: '-2 $l', cursor=3",
+ "SPEECH OUTPUT: '-2'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+ "4. Up",
+ ["BRAILLE LINE: '-1 $l'",
+ " VISIBLE: '-1 $l', cursor=3",
+ "BRAILLE LINE: '-1 $l'",
+ " VISIBLE: '-1 $l', cursor=3",
+ "SPEECH OUTPUT: '-1'"]))
+
+sequence.append(utils.AssertionSummaryAction())
+sequence.start()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]