aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoen De Cock <koendecock@users.noreply.github.com>2019-02-14 15:52:40 +0100
committerSun Zhe <31067185+ZheSun88@users.noreply.github.com>2019-03-06 10:30:35 +0200
commited065ee06c8fd571d60e592604c26e84339d9af3 (patch)
tree47ff60b414f56207179d477e4af19f2da531e546
parente4c06f027bd241446bcb42cbe36dc909a9608a5e (diff)
downloadvaadin-framework-ed065ee06c8fd571d60e592604c26e84339d9af3.tar.gz
vaadin-framework-ed065ee06c8fd571d60e592604c26e84339d9af3.zip
Fix initially selected CheckBox rendering in Safari in v7 compatibility package (#11024) (#11456)
This fix was already applied to com.vaadin.client.ui.VCheckBox but the committer forget to apply the same fix to the com.vaadin.v7.client.ui.VCheckBox. Some people are still temporarely using the checkbox from the compatibility package.
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCheckBox.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCheckBox.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCheckBox.java
index 9d4d52096c..ec6e02200e 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCheckBox.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCheckBox.java
@@ -16,7 +16,9 @@
package com.vaadin.v7.client.ui;
+import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.DOM;
@@ -106,4 +108,21 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox
public void setAriaInvalid(boolean invalid) {
AriaHelper.handleInputInvalid(getCheckBoxElement(), invalid);
}
+
+ @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(Style.Visibility.HIDDEN);
+ Scheduler.get().scheduleFinally(() -> {
+ getElement().getStyle().setVisibility(Style.Visibility.VISIBLE);
+ });
+ }
+ }
}