How to know if a component is hidden (partially/completely)?


Is it possible to know if a component is partially hidden in a browser window using server-side code? Consider a situation where a sub-window is partially or completely hidden in a browser window. Is there a way to find out which sub-windows or components are partially or completely hidden?
I thought of using window/component’s position and width against client area displayed in a browser window. But I do not see any way to get dimension of client area of a browser window. Am I missing something here?

Any help or pointers would be very helpful.


If I remember well, you should be able to use the CSS Tools add-on to get actual component size in pixels.
I have never used it myself, but I think there is a sample in the directory.

In any case, reading all this and computing visibility seems like a lot of work but I can’t think of any other way.

What do you want to use it for ? Maybe you can change your spec a little and do what you want without the need to know wether or not a component is hidden…

Thanks for quick response.

I want to display toolbox right next to the window. If the window is very close to the right edge of browser’s view port then the toolbox should appear on left side. Another situation is that some of the sub-windows might go out of the view port if a user resize the browser window. In such situation I want to bring those sub-windows back into the view port or at least notify user that few sub-windows are opened but not visible.


The windows going out of the screen seems kind of related to that

There is a ticket on this at the bottom of the post, you can voice your interest there to motivate somebody to include it in the core of vaadin.

As for a work around, I am afraid I cannot help you.
You could make your toolbox part of the window and have a button to expand/retract it on the side, like this as long as your window is on screen, the toolbox is on screen too.

The issue is little different in the sense that when the sub-window was opened it was in the view-port of browser but after browser window is resized it goes outside the view-port. You can notice same issue in Vaadin sampler. Any pointer.