Vaadin get focused element

I have a problem with focus on Vaadin. The problem occurs when I open new Window (dialog) on e.g. button click:

new Window(caption, component); When Window is closed the method close() is executed. Its implementation from Window class:

public void close() {
UI uI = getUI(); // Don't do anything if not attached to a UI
if (uI != null) {
// focus is restored to the parent window
uI.focus();
// window is removed from the UI
uI.removeWindow(this); }
}

As shown, the focus is set to the UI instead of component which caused a window opened. Is there a way to set component focus to e.g. button which caused window opened? I am looking for a generic solution. I have a workaround in which I am extending Window class and create field for Component. After window is created I set component field to the one which caused the window opened. But as I said - I see it as a workaround.

Hi,

Sounds like that workaround is the best you can get, at least without a change to the framework. Feel free to submit a
ticket
, or take a stab at fixing it yourself even.

Best regards,

Olli