From e5589f90c922f776e240c3b2d5493af93242e56d Mon Sep 17 00:00:00 2001 From: Henrik Paul Date: Mon, 18 Aug 2014 14:45:27 +0300 Subject: Fixes disappearing scrollbar bug (#13334) Change-Id: I4d956c330d0fe5473911951cc17fd919424aa916 --- .../com/vaadin/client/ui/grid/ScrollbarBundle.java | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'client') diff --git a/client/src/com/vaadin/client/ui/grid/ScrollbarBundle.java b/client/src/com/vaadin/client/ui/grid/ScrollbarBundle.java index 59583dcfec..5a54f5fc68 100644 --- a/client/src/com/vaadin/client/ui/grid/ScrollbarBundle.java +++ b/client/src/com/vaadin/client/ui/grid/ScrollbarBundle.java @@ -271,13 +271,6 @@ abstract class ScrollbarBundle { private ScrollbarBundle() { root.appendChild(scrollSizeElement); - Event.sinkEvents(root, Event.ONSCROLL); - Event.setEventListener(root, new EventListener() { - @Override - public void onBrowserEvent(Event event) { - invisibleScrollbarTemporaryResizer.show(); - } - }); } protected abstract int internalGetScrollSize(); @@ -517,6 +510,20 @@ abstract class ScrollbarBundle { */ public final void setScrollbarThickness(int px) { isInvisibleScrollbar = (px == 0); + + if (isInvisibleScrollbar) { + Event.sinkEvents(root, Event.ONSCROLL); + Event.setEventListener(root, new EventListener() { + @Override + public void onBrowserEvent(Event event) { + invisibleScrollbarTemporaryResizer.show(); + } + }); + } else { + Event.sinkEvents(root, 0); + Event.setEventListener(root, null); + } + internalSetScrollbarThickness(Math.max(1, px)); } -- cgit v1.2.3