View Full Version : [FNR] Tooltip position not correct with scrollbars

22 Nov 2010, 5:43 AM

there is a bug with tooltip positions when there are scrollbars, they are not included in the calculation of the position.

GXT 2.2.1
Firefox 3.6.12

The method com.extjs.gxt.ui.client.widget.tips.Tip.showAt() uses finally com.extjs.gxt.ui.client.core.XDOM.getViewportWidth()/Height(), which uses native $wnd.self.innerWidth/innerHeight, which is not aware of scrollbars, so the tooltip is not moved far enough to the left/top.

Screenshot for wrong horizontal position (the horizontal scrollbar only appears because of the wrong position of the tooltip):

Code of screenshot (adjust browser size so that vertical scrollbar appears, and tooltip has to be moved to the left):

public class Test implements EntryPoint {

public void onModuleLoad() {
RootPanel rootPanel = RootPanel.get();

HorizontalPanel hp1 = new HorizontalPanel();
TextField<String> tf1 = new TextField<String>();
Label l2 = new Label("label");
l2.setToolTip("you should see the complete tooltip");



Would be nice if this can be fixed.

Thanks and greetings, Marc

14 Dec 2010, 2:43 AM
Mh, no reaction yet?
Anything not clear with this problem? Sven?

14 Dec 2010, 3:08 AM
Its on the list but very low priority. No need to bump it.

Stephan Stückmann
14 Dec 2010, 3:24 AM
Hi Sven.

Marc is a colleague of me. For our "styleguide and usability" people this bug unfortunately is not low priority, that's the reason we "bumped" it. Is there any chance to raise priority on your side, too?

Thanks in advance,


14 Dec 2010, 3:43 AM
The easiest would be to simple try to change to doctype to strict. Also if this is a high priority issue for you, you should open a ticket inside your ticketsystem.

9 Apr 2011, 12:25 PM
I still have this bug, are there any plan on fixing it soon?
In the meanwhile, i don't understand the proposed workaround about the doctype, can someone explain it better?
We tried every doctype displayed on w3c, none of them worked.

9 May 2011, 3:43 AM
Hi, sorry, didn't see your post earlier.
Doctype changing didn't work for us, too.
We ended in patching GXT ourself, in class com.extjs.gxt.ui.client.core.El

protected Point getConstrainToXY(Element elem, Point proposedXY) {
int vw, vh, vx = 0, vy = 0;
if (elem == XDOM.getBody()) {
vw = XDOM.getViewportSize().width;
vh = XDOM.getViewportSize().height;

// get client- and scrollSize from html element, on body it's always the same!
int scrollHeight = elem.getParentElement().getScrollHeight();
int clientHeight = elem.getParentElement().getClientHeight();
boolean isScrollableY = scrollHeight > clientHeight;
vw -= (XDOM.getScrollBarWidth());
int scrollWidth = elem.getParentElement().getScrollWidth();
int clientWidth = elem.getParentElement().getClientWidth();
boolean isScrollableX = scrollWidth > clientWidth;
if(isScrollableX) {
vh -= (XDOM.getScrollBarWidth());

} else {
vw = fly(elem, "_internal").getWidth();
vh = fly(elem, "_internal").getHeight();


9 May 2011, 3:47 AM
PS: Now there's another problem left: the tooltip might hide the field for which it is displayed, when the field is in the lower right corner of the viewport...

2 Jun 2011, 1:49 PM
Hi, thank you for your answer.

We put your code in GXT 2.1.1 but we are not able to compile GXT.jar.

- How can we compile GXT.jar?


14 Sep 2011, 2:46 AM
A change that probably will fix this problem was commited to SVN now and will be part of the next release.