summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/TabSheet.java
diff options
context:
space:
mode:
authormichaelvogt <michael@vaadin.com>2013-06-24 13:55:55 +0300
committerVaadin Code Review <review@vaadin.com>2013-07-12 11:24:11 +0000
commitc44ca1270523c544b9aedabe7f9780a5e6862859 (patch)
treeb1cae7adffd770634e5c597dadc2b2336c34849f /server/src/com/vaadin/ui/TabSheet.java
parente45e036598d6efcf26ba1d2c27b4eeadcb32a9b9 (diff)
downloadvaadin-framework-c44ca1270523c544b9aedabe7f9780a5e6862859.tar.gz
vaadin-framework-c44ca1270523c544b9aedabe7f9780a5e6862859.zip
Tabsheet should not immediately select a tab when changing tab using
keyboard (#11823) Adds the necessary WAI-ARIA roles to the component (#11827) Change-Id: Ie1ed40227679e3497971b834919713614a8cc23e
Diffstat (limited to 'server/src/com/vaadin/ui/TabSheet.java')
-rw-r--r--server/src/com/vaadin/ui/TabSheet.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/TabSheet.java b/server/src/com/vaadin/ui/TabSheet.java
index 3ba1861b6f..a1f9e9dd26 100644
--- a/server/src/com/vaadin/ui/TabSheet.java
+++ b/server/src/com/vaadin/ui/TabSheet.java
@@ -615,6 +615,11 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
// connector
if (selected != null) {
selected.markAsDirtyRecursive();
+
+ Tab tab = getTab(c);
+ if (tab != null && tab.getDefaultFocusComponent() != null) {
+ tab.getDefaultFocusComponent().focus();
+ }
}
}
@@ -955,6 +960,23 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
public void setClosable(boolean closable);
/**
+ * Set the component that should automatically focused when the tab is
+ * selected.
+ *
+ * @param component
+ * the component to focus
+ */
+ public void setDefaultFocusComponent(Focusable component);
+
+ /**
+ * Get the component that should be automatically focused when the tab
+ * is selected.
+ *
+ * @return the focusable component
+ */
+ public Focusable getDefaultFocusComponent();
+
+ /**
* Returns the enabled status for the tab. A disabled tab is shown as
* such in the tab bar and cannot be selected.
*
@@ -1136,6 +1158,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
private String styleName;
private String id;
private String iconAltText = "";
+ private Focusable defaultFocus;
public TabSheetTabImpl(String caption, Resource icon) {
if (caption == null) {
@@ -1189,6 +1212,16 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
}
@Override
+ public void setDefaultFocusComponent(Focusable defaultFocus) {
+ this.defaultFocus = defaultFocus;
+ }
+
+ @Override
+ public Focusable getDefaultFocusComponent() {
+ return defaultFocus;
+ }
+
+ @Override
public boolean isEnabled() {
return enabled;
}