diff options
author | Artur Signell <artur@vaadin.com> | 2016-04-16 16:43:59 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-04-28 15:18:39 +0000 |
commit | ab30dfe29d12e57d7c00c12cf2edc9328cb47a65 (patch) | |
tree | 7996d952bc3e57e79c6b4d3d7343bbc3dc1a347a /client/src | |
parent | 9006dbdf5a2d6d34d6322a8affc743087b5b46f5 (diff) | |
download | vaadin-framework-ab30dfe29d12e57d7c00c12cf2edc9328cb47a65.tar.gz vaadin-framework-ab30dfe29d12e57d7c00c12cf2edc9328cb47a65.zip |
Scroll selected tab into view (#3899)
Change-Id: I4e86caa4ad02dfc5d0eaa33b85f67da3837fcea0
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VTabsheet.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VTabsheet.java b/client/src/main/java/com/vaadin/client/ui/VTabsheet.java index e196870348..1ea41f634d 100644 --- a/client/src/main/java/com/vaadin/client/ui/VTabsheet.java +++ b/client/src/main/java/com/vaadin/client/ui/VTabsheet.java @@ -531,6 +531,9 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware public void selectTab(int index) { final Tab newSelected = getTab(index); final Tab oldSelected = selected; + if (oldSelected == newSelected) { + return; + } newSelected.setStyleNames(true, isFirstVisibleTab(index), true); newSelected.setTabulatorIndex(getTabsheet().tabulatorIndex); @@ -552,6 +555,10 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware // The selected tab might need more (or less) space newSelected.recalculateCaptionWidth(); getTab(tabsheet.activeTabIndex).recalculateCaptionWidth(); + + // Scroll the tab into view if it is not already + getTabsheet().scrollIntoView(getTab(tabsheet.activeTabIndex)); + } public Tab navigateTab(int fromIndex, int toIndex) { |