[orca] More work on focus and browse mode * Add setting to control whether or not caret nav triggers auto f
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] More work on focus and browse mode * Add setting to control whether or not caret nav triggers auto f
- Date: Wed, 13 Aug 2014 23:12:53 +0000 (UTC)
commit af4d72ea7105a4f0d57e6ff1cb0f0cce4ff16527
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Aug 13 19:10:16 2014 -0400
More work on focus and browse mode
* Add setting to control whether or not caret nav triggers auto focus mode
* Add ability to set focus mode to sticky
src/orca/cmdnames.py | 11 +++++++++++
src/orca/messages.py | 11 +++++++++++
src/orca/scripts/toolkits/Gecko/keymaps.py | 1 +
src/orca/scripts/toolkits/Gecko/script.py | 22 +++++++++++++++++++---
src/orca/settings.py | 1 +
5 files changed, 43 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/cmdnames.py b/src/orca/cmdnames.py
index dbfa15f..01787df 100644
--- a/src/orca/cmdnames.py
+++ b/src/orca/cmdnames.py
@@ -960,6 +960,17 @@ TABLE_CELL_UP = _("Goes up one cell.")
# between these two modes.
TOGGLE_PRESENTATION_MODE = _("Switches between browse mode and focus mode.")
+# Translators: (Please see the previous, detailed translator notes about
+# Focus mode and Browse mode.) In order to minimize the amount of work Orca
+# users need to do to switch between focus mode and browse mode, Orca attempts
+# to automatically switch to the mode which is appropriate to the current
+# web element. Sometimes, however, this automatic mode switching is not what
+# the user wants. A good example being web apps which have their own keyboard
+# navigation and use interaction model. As a result, Orca has a command which
+# enables setting a "sticky" focus mode which disables all automatic toggling.
+# This string is associated with the Orca command to enable sticky focus mode.
+SET_FOCUS_MODE_STICKY = _("Enables sticky focus mode.")
+
# Translators: this is for navigating among unvisited links in a document.
UNVISITED_LINK_PREV = _("Goes to previous unvisited link.")
diff --git a/src/orca/messages.py b/src/orca/messages.py
index 1d5560c..f98e158 100644
--- a/src/orca/messages.py
+++ b/src/orca/messages.py
@@ -1105,6 +1105,17 @@ MODE_BROWSE = _("Browse mode")
# This string is the message presented when Orca switches to focus mode.
MODE_FOCUS = _("Focus mode")
+# Translators: (Please see the previous, detailed translator notes about
+# Focus mode and Browse mode.) In order to minimize the amount of work Orca
+# users need to do to switch between focus mode and browse mode, Orca attempts
+# to automatically switch to the mode which is appropriate to the current
+# web element. Sometimes, however, this automatic mode switching is not what
+# the user wants. A good example being web apps which have their own keyboard
+# navigation and use interaction model. As a result, Orca has a command which
+# enables setting a "sticky" focus mode which disables all automatic toggling.
+# This string is the message presented when Orca switches to sticky focus mode.
+MODE_FOCUS_IS_STICKY = _("Focus mode is sticky.")
+
# Translators: Hovering the mouse over certain objects on a web page causes a
# new object to appear such as a pop-up menu. Orca has a command will move the
# user to the object which just appeared as a result of the user hovering the
diff --git a/src/orca/scripts/toolkits/Gecko/keymaps.py b/src/orca/scripts/toolkits/Gecko/keymaps.py
index d4516a5..38f6045 100644
--- a/src/orca/scripts/toolkits/Gecko/keymaps.py
+++ b/src/orca/scripts/toolkits/Gecko/keymaps.py
@@ -86,6 +86,7 @@ commonKeymap = (
"toggleCaretNavigationHandler"),
("a", defaultModifierMask, ORCA_MODIFIER_MASK, "togglePresentationModeHandler"),
+ ("a", defaultModifierMask, ORCA_MODIFIER_MASK, "enableStickyFocusModeHandler", 2),
)
desktopKeymap = (
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 1ae42a3..1c7faac 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -235,6 +235,7 @@ class Script(default.Script):
self.inMouseOverObject = False
self._inFocusMode = False
+ self._focusModeIsSticky = False
self._lastCommandWasCaretNav = False
self._lastCommandWasStructNav = False
@@ -428,6 +429,11 @@ class Script(default.Script):
Script.togglePresentationMode,
cmdnames.TOGGLE_PRESENTATION_MODE)
+ self.inputEventHandlers["enableStickyFocusModeHandler"] = \
+ input_event.InputEventHandler(
+ Script.enableStickyFocusMode,
+ cmdnames.SET_FOCUS_MODE_STICKY)
+
def __getArrowBindings(self):
"""Returns an instance of keybindings.KeyBindings that use the
arrow keys for navigating HTML content.
@@ -1238,10 +1244,17 @@ class Script(default.Script):
default.Script.handleProgressBarUpdate(self, event, obj)
def _useFocusMode(self, obj):
+ if self._focusModeIsSticky:
+ return True
+
if not orca.settings.structNavTriggersFocusMode \
and self._lastCommandWasStructNav:
return False
+ if not orca.settings.caretNavTriggersFocusMode \
+ and self._lastCommandWasCaretNav:
+ return False
+
try:
role = obj.getRole()
state = obj.getState()
@@ -1252,9 +1265,6 @@ class Script(default.Script):
and not state.contains(pyatspi.STATE_SELECTED):
return False
- if self._inFocusMode:
- return True
-
if state.contains(pyatspi.STATE_EDITABLE) \
or state.contains(pyatspi.STATE_EXPANDABLE):
return True
@@ -3811,6 +3821,11 @@ class Script(default.Script):
else:
self.presentMessage(messages.LIVE_REGIONS_OFF)
+ def enableStickyFocusMode(self, inputEvent):
+ self._inFocusMode = True
+ self._focusModeIsSticky = True
+ self.presentMessage(messages.MODE_FOCUS_IS_STICKY)
+
def togglePresentationMode(self, inputEvent):
if self._inFocusMode:
[obj, characterOffset] = self.getCaretContext()
@@ -3827,6 +3842,7 @@ class Script(default.Script):
else:
self.presentMessage(messages.MODE_FOCUS)
self._inFocusMode = not self._inFocusMode
+ self._focusModeIsSticky = False
def toggleCaretNavigation(self, inputEvent):
"""Toggles between Firefox native and Orca caret navigation."""
diff --git a/src/orca/settings.py b/src/orca/settings.py
index d4502bd..7673857 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -360,3 +360,4 @@ timeoutCallback = None # Set by orca.py:init to orca.timeout
# NOTE: At the moment items here are experimental and may be changed or
# replaced or removed.
structNavTriggersFocusMode = True
+caretNavTriggersFocusMode = False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]