Modal window stays open (and on top) when browser's back button is clicked

Hi,

From a View the user can click a link to open a modal Window. This will block all view content which is pushed to the background. However the user can still use the browser’s back button which redirects the user to the previous page, however with the openend window on top of it.

I would expect the Window to be closed when using the browsers back button.

How can I make sure that all opened Windows are closed when the user uses the browsers back button ?

Thank you in advance.
Kind regards,
Richard

Hi,

as far as I know there’s no automatic support for this, but if you’re using Navigator class, you could register a ViewChangeListener and close all the windows from there when the user navigates to another view. You can get all the windows with UI.getCurrent().getWindows(). The only drawback is that I don’t think there’s any way to differentiate between “normal” navigation and a back-button click.

-tepi

Hi,

Thank you for your response.

Have tried your piece of code and works great.

Richard