summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAnna Miroshnik <anna.miroshnik@arcadia.spb.ru>2014-09-23 17:18:45 +0400
committerSauli Tähkäpää <sauli@vaadin.com>2014-10-29 09:03:43 +0200
commitd3a707c2bcd4c0fa7214714bdff800b2a3f5d474 (patch)
tree640f7bd663e88736c61a53941b34391209b55353 /client
parent995fe9c6ab00d14d46e4ba76a7cc5c24bec63c32 (diff)
downloadvaadin-framework-d3a707c2bcd4c0fa7214714bdff800b2a3f5d474.tar.gz
vaadin-framework-d3a707c2bcd4c0fa7214714bdff800b2a3f5d474.zip
fix: Tooltip does not shrink when content changes (#11871)
Change-Id: I6b0cc0996560b2f8dd28e110e455445952c0fbd9
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/VTooltip.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java
index d61af537a9..edd1273bf5 100644
--- a/client/src/com/vaadin/client/VTooltip.java
+++ b/client/src/com/vaadin/client/VTooltip.java
@@ -132,6 +132,22 @@ public class VTooltip extends VOverlay {
}
if (info.getTitle() != null && !info.getTitle().isEmpty()) {
description.setInnerHTML(info.getTitle());
+ /*
+ * Issue #11871: to correctly update the offsetWidth of description
+ * element we need to clear style width of it's parent DIV from old
+ * value (in some strange cases this width=[tooltip MAX_WIDTH] after
+ * tooltip text has been already updated to new shortly value:
+ *
+ * <div class="popupContent"> <div style="width: 500px;"> <div
+ * class="v-errormessage" aria-hidden="true" style="display: none;">
+ * <div class="gwt-HTML"> </div> </div> <div
+ * class="v-tooltip-text">This is a short tooltip</div> </div>
+ *
+ * and it leads to error during calculation offsetWidth (it is
+ * native GWT method getSubPixelOffsetWidth()) of description
+ * element")
+ */
+ description.getParentElement().getStyle().clearWidth();
description.getStyle().clearDisplay();
} else {
description.setInnerHTML("");
@@ -151,6 +167,7 @@ public class VTooltip extends VOverlay {
// in the right or bottom edge. For this reason the tooltip is moved
// first to 0,0 position so that the calculation goes correctly.
setPopupPosition(0, 0);
+
setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {