diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2018-07-10 11:14:05 +0300 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2018-07-10 11:14:05 +0300 |
commit | 71b6a20b60d8e3021ab1459bdf2ff1b9c5e3e6ab (patch) | |
tree | 171d79babcaf32e2dfbb6c4dfbf26771babb7b98 /client/src | |
parent | efb6403e5b64cec40728f30f49543fa8aa48d891 (diff) | |
download | vaadin-framework-71b6a20b60d8e3021ab1459bdf2ff1b9c5e3e6ab.tar.gz vaadin-framework-71b6a20b60d8e3021ab1459bdf2ff1b9c5e3e6ab.zip |
Fix initially selected CheckBox rendering in Safari (#11024)
Diffstat (limited to 'client/src')
-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); + }); + } + } } |