summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/Window.java
diff options
context:
space:
mode:
authormichaelvogt <michael@vaadin.com>2013-06-14 17:08:38 +0300
committerVaadin Code Review <review@vaadin.com>2013-07-12 07:20:38 +0000
commite45e036598d6efcf26ba1d2c27b4eeadcb32a9b9 (patch)
tree3b4465ae54ec442f77fc1880f82b31172f56fda3 /server/src/com/vaadin/ui/Window.java
parent104e472d21e92c3023abc4cfe96e67861424927c (diff)
downloadvaadin-framework-e45e036598d6efcf26ba1d2c27b4eeadcb32a9b9.tar.gz
vaadin-framework-e45e036598d6efcf26ba1d2c27b4eeadcb32a9b9.zip
Prevent to exit a Window with the tab key (#11874)
Change-Id: Icd12ec6e2eac626ad493707dfa8288d620bb9bb7
Diffstat (limited to 'server/src/com/vaadin/ui/Window.java')
-rw-r--r--server/src/com/vaadin/ui/Window.java77
1 files changed, 77 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java
index 980e96c384..658c821f88 100644
--- a/server/src/com/vaadin/ui/Window.java
+++ b/server/src/com/vaadin/ui/Window.java
@@ -1100,4 +1100,81 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
public WindowRole getAssistiveRole() {
return getState().role;
}
+
+ /**
+ * Set if it should be prevented to set the focus to a component outside the
+ * window with the tab key.
+ * <p>
+ * This is meant to help users of assistive devices to not leaving the
+ * window unintentionally.
+ *
+ * @param tabStop
+ * true to keep the focus inside the window when reaching the top
+ * or bottom, false (default) to allow leaving the window
+ */
+ public void setTabStopEnabled(boolean tabStop) {
+ getState().assistiveTabStop = tabStop;
+ }
+
+ /**
+ * Get if it is prevented to leave a window with the tab key.
+ *
+ * @return true when the focus is limited to inside the window, false when
+ * focus can leave the window
+ */
+ public boolean isTabStopEnabled() {
+ return getState().assistiveTabStop;
+ }
+
+ /**
+ * Sets the message that is provided to users of assistive devices when the
+ * user reaches the top of the window when leaving a window with the tab key
+ * is prevented.
+ * <p>
+ * This message is not visible on the screen.
+ *
+ * @param topMessage
+ * String provided when the user navigates with Shift-Tab keys to
+ * the top of the window
+ */
+ public void setTabStopTopAssistiveText(String topMessage) {
+ getState().assistiveTabStopTopText = topMessage;
+ }
+
+ /**
+ * Sets the message that is provided to users of assistive devices when the
+ * user reaches the bottom of the window when leaving a window with the tab
+ * key is prevented.
+ * <p>
+ * This message is not visible on the screen.
+ *
+ * @param bottomMessage
+ * String provided when the user navigates with the Tab key to
+ * the bottom of the window
+ */
+ public void setTabStopBottomAssistiveText(String bottomMessage) {
+ getState().assistiveTabStopBottomText = bottomMessage;
+ }
+
+ /**
+ * Gets the message that is provided to users of assistive devices when the
+ * user reaches the top of the window when leaving a window with the tab key
+ * is prevented.
+ *
+ * @return the top message
+ */
+ public String getTabStopTopAssistiveText() {
+ return getState().assistiveTabStopTopText;
+ }
+
+ /**
+ * Gets the message that is provided to users of assistive devices when the
+ * user reaches the bottom of the window when leaving a window with the tab
+ * key is prevented.
+ *
+ * @return the bottom message
+ */
+ public String getTabStopBottomAssistiveText() {
+ return getState().assistiveTabStopBottomText;
+ }
}