Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
adding keyboard shortcut for tabsheets
Hello,
I have been trying to add keyboard shortcuts to tabsheets. It works only for first tabsheet and not subsequent ones.
My code below has 2 tabsheets and second tabsheet has 3 more tabs in it.
I can only go from first tabsheet to second using TAB but nothing else works.
A quick help by anybody is highly appreciated!
mainTab = new TabSheet(); //main
searchTab = new TabSheet();
tabsResults = new TabSheet();
//tabResults which is the second tabsheet has 3 tabs within it
tabsResults.setWidth(RESULTS_TAB_SIZE);
querySummary = // returns a Panel
metrics = // returns a Panel
decisions = // returns a Panel
querySummary.addShortcutListener(new ShortcutListener("Tab", ShortcutAction.KeyCode.TAB, null) {
@Override
public void handleAction(Object sender, Object target) {
tabsResults.setSelectedTab(1);
}
});
metrics.addShortcutListener(new ShortcutListener("Tab", ShortcutAction.KeyCode.TAB, null) {
@Override
public void handleAction(Object sender, Object target) {
tabsResults.setSelectedTab(2);
}
});
decisions.addShortcutListener(new ShortcutListener("Tab", ShortcutAction.KeyCode.TAB, null) {
@Override
public void handleAction(Object sender, Object target) {
tabsResults.setSelectedTab(0);
}
});
tabsResults.addTab(querySummary, "sub tab1");
tabsResults.addTab(metrics, "sub tab2");
tabsResults.addTab(decisions, "sub tab3");
searchTab.setWidth(RESULTS_TAB_SIZE);
searchTab.addShortcutListener(new ShortcutListener("Tab 1", ShortcutAction.KeyCode.TAB, null) {
@Override
public void handleAction(Object sender, Object target) {
mainTab.setSelectedTab(1);
}
});
tabsResults.addShortcutListener(new ShortcutListener("Tab 2", ShortcutAction.KeyCode.TAB, null) {
@Override
public void handleAction(Object sender, Object target) {
mainTab.setSelectedTab(2);
}
});
searchTab.addComponent(createComplexSearchComponent());
mainTab.addTab(searchTab, "Search");
mainTab.addTab(tabsResults, "Results");
Hi Shehnaz!
Can you post your question to the Framework UI section https://vaadin.com/forum#!/category/10391260.
This section is for Vaadin Elements (Web Components) :D
Thanks!
Sami