From 481166bc020d1bde0b2f763751a863012b4dc93a Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 29 Jun 2012 16:54:49 +0300 Subject: [PATCH] Ensure only click events scroll tabs (#9077) --- .../gwt/client/ui/tabsheet/VTabsheet.java | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ui/tabsheet/VTabsheet.java b/src/com/vaadin/terminal/gwt/client/ui/tabsheet/VTabsheet.java index 24ea3b2d38..844708a892 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/tabsheet/VTabsheet.java +++ b/src/com/vaadin/terminal/gwt/client/ui/tabsheet/VTabsheet.java @@ -685,24 +685,27 @@ public class VTabsheet extends VTabsheetBase implements Focusable, @Override public void onBrowserEvent(Event event) { + if (event.getTypeInt() == Event.ONCLICK) { + // Tab scrolling + if (isScrolledTabs() && DOM.eventGetTarget(event) == scrollerPrev) { + int newFirstIndex = tb.scrollLeft(scrollerIndex); + if (newFirstIndex != -1) { + scrollerIndex = newFirstIndex; + updateTabScroller(); + } + return; + } else if (isClippedTabs() + && DOM.eventGetTarget(event) == scrollerNext) { + int newFirstIndex = tb.scrollRight(scrollerIndex); - // Tab scrolling - if (isScrolledTabs() && DOM.eventGetTarget(event) == scrollerPrev) { - int newFirstIndex = tb.scrollLeft(scrollerIndex); - if (newFirstIndex != -1) { - scrollerIndex = newFirstIndex; - updateTabScroller(); - } - } else if (isClippedTabs() && DOM.eventGetTarget(event) == scrollerNext) { - int newFirstIndex = tb.scrollRight(scrollerIndex); - - if (newFirstIndex != -1) { - scrollerIndex = newFirstIndex; - updateTabScroller(); + if (newFirstIndex != -1) { + scrollerIndex = newFirstIndex; + updateTabScroller(); + } + return; } - } else { - super.onBrowserEvent(event); } + super.onBrowserEvent(event); } /** -- 2.39.5