flow icon indicating copy to clipboard operation
flow copied to clipboard

UI is unresponsive after invoking navigate and displaying a modal dialog

Open dex-ds opened this issue 6 months ago • 5 comments

Describe the bug

Calling UI.navigate(MyRoute.class) and opening a modal dialog in the beforeEnter hook results in an unresponsive UI. For example, the loading indicator keeps blinking indefinitely. This issue seems to occur because the modal dialog blocks the navigation lifecycle, preventing the UI from completing the transition. Without the modal, navigation proceeds normally.

Expected-behavior

With/Without the modal, navigation should be proceed normally.

Reproduction

Call a Route with UI.navigate(MyRoute.class) on MyRoute.class call

	@Override
	public void beforeEnter(BeforeEnterEvent event) {

        Dialog dialog = new Dialog();
        dialog.add(new Label());
        dialog.setCloseOnOutsideClick(true);
        dialog.setModal(true);
        dialog.open();
		
		super.beforeEnter(event);
	}

MyRoute.class contains an image and uses the new DownloadHandler as a resource, since StreamResourceApi is deprecated. However, when a modal dialog is opened, the resource fails to load (HTTP 302). This redirect triggers the StreamRequestHandler, which then returns a 403 error.

Image

System Info

Vaadin 24.8.2, 24.8.3 Jetty 12.0.23

dex-ds avatar Jul 17 '25 10:07 dex-ds

Workaround from vaadin prime support getElement().executeJs("return").then(x->dialog.open()); I can confirm that works and we use this until a bugfix is available.

dex-ds avatar Jul 18 '25 06:07 dex-ds

Move your dialog to afterNavigation or below the super call.

knoobie avatar Jul 21 '25 07:07 knoobie

@knoobie this doesn't work. On prime support chat we explored all possible options, including other potential events. The last statement was that this particular case was not considered and that it is a bug.

dex-ds avatar Jul 21 '25 11:07 dex-ds

Workaround from vaadin prime support getElement().executeJs("return").then(x->dialog.open()); I can confirm that works and we use this until a bugfix is available.

Note: If you're using the vcf-pdf-viewer => with this workaround, loading via the DownloadHandler API does not work initially. The viewer remains empty. "The workaround for the workaround" is getElement().executeJs("return").then(x -> pdfView.setSrc(res.value()));

dex-ds avatar Jul 21 '25 11:07 dex-ds

Is there someone on vaadin to fix this bug or give a statement? Thanks! 😊

dex-ds avatar Oct 17 '25 13:10 dex-ds