Postpone / Proceed on Login

Hello all,

I have to implement a feature that is something like a consent message when the user logs in. I decided to try and use the postpone/proceed feature in Vaadin 23, but I am having trouble getting it to work.

Since the user could already be logged in to the webapp (cookies), or have SSO configured, they will not always pass through the login screen, so adding it there won’t work all of the time. Instead, I added it to the UIInitListener using a VaadinServiceInitListener as detailed below. However, the behavior I get is after clicking “Confirm” in the confirm dialog, I simply get dropped to a blank screen.

I used the plain Java Vaadin 23 starter to duplicate the issue, only adding a VaadinServiceInitListener:

`public class ApplicationInitListener implements VaadinServiceInitListener
{
@Override
public void serviceInit( ServiceInitEvent event )
{
event.getSource().addUIInitListener( this::handleInit );
}

private void handleInit( UIInitEvent event )
{
    event.getUI().addBeforeLeaveListener( this::simplePostpone );
}

private void simplePostpone( BeforeLeaveEvent event )
{
    String path = event.getLocation().getPathWithQueryParameters();
    
    System.out.println( "BeforeLeaveEvent: " + path );
    System.out.println( "\tTrigger: " + event.getTrigger() );
    System.out.println( "\tNavigation Target: " + event.getNavigationTarget() );
    
    BeforeLeaveEvent.ContinueNavigationAction action = event.postpone();
    
    ConfirmDialog confirmDialog = new ConfirmDialog();
    confirmDialog.setText( "Are you sure?" );
    confirmDialog.setCancelable( true );
    
    confirmDialog.addConfirmListener( e -> {
        System.out.println( "Calling proceed" );
        action.proceed();
    } );
    
    confirmDialog.open();
}

}`

If you have a main layout: it’s probably the easiest to do it in there

I do have something in mind to work around it, but I guess I’m just trying to determine if I am using the feature incorrectly, it’s a bug, or simply not intended for this use case.

FWIW this has been recognized as a bug after submitting a ticket: https://github.com/vaadin/flow/issues/18610