diff options
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VCheckBox.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VCheckBox.java b/client/src/main/java/com/vaadin/client/ui/VCheckBox.java index e53bce5d4b..2c2df0a27e 100644 --- a/client/src/main/java/com/vaadin/client/ui/VCheckBox.java +++ b/client/src/main/java/com/vaadin/client/ui/VCheckBox.java @@ -16,7 +16,9 @@ package com.vaadin.client.ui; +import com.google.gwt.core.client.Scheduler; import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.Style.Visibility; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; import com.vaadin.client.ApplicationConnection; @@ -116,4 +118,21 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox errorIndicatorElement = null; } } + + @Override + protected void onAttach() { + super.onAttach(); + + if (BrowserInfo.get().isSafari()) { + /* + * Sometimes Safari does not render checkbox correctly when + * attaching. Setting the visibility to hidden and a bit later + * restoring will make everything just fine. + */ + getElement().getStyle().setVisibility(Visibility.HIDDEN); + Scheduler.get().scheduleFinally(() -> { + getElement().getStyle().setVisibility(Visibility.VISIBLE); + }); + } + } } |