]> source.dussan.org Git - vaadin-framework.git/commitdiff
Ensure only click events scroll tabs (#9077)
authorArtur Signell <artur@vaadin.com>
Fri, 29 Jun 2012 13:54:49 +0000 (16:54 +0300)
committerArtur Signell <artur@vaadin.com>
Fri, 29 Jun 2012 13:55:49 +0000 (16:55 +0300)
src/com/vaadin/terminal/gwt/client/ui/tabsheet/VTabsheet.java

index 24ea3b2d3861bb1116d09ab006b0ef855dc935ce..844708a8922bd73804b178c5aa8b2cb3655f1d2d 100644 (file)
@@ -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);
     }
 
     /**