diff options
author | Artur <artur@vaadin.com> | 2017-07-27 13:41:17 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-07-27 13:41:17 +0300 |
commit | 390fd31dc18d026a60a89e9b5cba040859cc3393 (patch) | |
tree | 734b3de37b021f541ef209d9b72fb567ec0cdd66 /client | |
parent | 410965ddca3e601343f8b759e1a27a2c1b0d0f29 (diff) | |
download | vaadin-framework-390fd31dc18d026a60a89e9b5cba040859cc3393.tar.gz vaadin-framework-390fd31dc18d026a60a89e9b5cba040859cc3393.zip |
Implement GWT Focusable so tab indexes work correctly in MenuBar (#9733)
Fixes #9550
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/SimpleFocusablePanel.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/SimpleFocusablePanel.java b/client/src/main/java/com/vaadin/client/ui/SimpleFocusablePanel.java index cda90a098c..6539103c63 100644 --- a/client/src/main/java/com/vaadin/client/ui/SimpleFocusablePanel.java +++ b/client/src/main/java/com/vaadin/client/ui/SimpleFocusablePanel.java @@ -30,9 +30,9 @@ import com.google.gwt.event.dom.client.KeyPressHandler; import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.user.client.ui.Focusable; import com.google.gwt.user.client.ui.SimplePanel; import com.google.gwt.user.client.ui.impl.FocusImpl; -import com.vaadin.client.Focusable; /** * Compared to FocusPanel in GWT this panel does not support eg. accesskeys, but @@ -40,7 +40,7 @@ import com.vaadin.client.Focusable; */ public class SimpleFocusablePanel extends SimplePanel implements HasFocusHandlers, HasBlurHandlers, HasKeyDownHandlers, - HasKeyPressHandlers, Focusable { + HasKeyPressHandlers, Focusable, com.vaadin.client.Focusable { public SimpleFocusablePanel() { // make focusable, as we don't need access key magic we don't need to @@ -72,6 +72,7 @@ public class SimpleFocusablePanel extends SimplePanel return addDomHandler(handler, KeyUpEvent.getType()); } + @Override public void setFocus(boolean focus) { if (focus) { FocusImpl.getFocusImplForPanel().focus(getElement()); @@ -85,7 +86,18 @@ public class SimpleFocusablePanel extends SimplePanel setFocus(true); } + @Override public void setTabIndex(int tabIndex) { getElement().setTabIndex(tabIndex); } + + @Override + public int getTabIndex() { + return getElement().getTabIndex(); + } + + @Override + public void setAccessKey(char key) { + FocusUtil.setAccessKey(this, key); + } } |