diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2018-07-10 11:14:05 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2018-07-10 12:50:43 +0300 |
commit | ba7e42c60b9618aabdfbb201cfcc2ae1b50c1bea (patch) | |
tree | 83aecf75f09199529ded835ed0a7b086a3d757b7 | |
parent | 5dc71970962627c48b5278201f5b3c8a24daed33 (diff) | |
download | vaadin-framework-ba7e42c60b9618aabdfbb201cfcc2ae1b50c1bea.tar.gz vaadin-framework-ba7e42c60b9618aabdfbb201cfcc2ae1b50c1bea.zip |
Fix initially selected CheckBox rendering in Safari (#11024)
-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); + }); + } + } } |