Wizard inside a modal/popup

Is it possible to create a wizard inside a VirtualPage or popup/modal window? I tried what seemed to be the obvious approach of something like:

$button = $app->add([‘Button’, ‘vp wizard’]);
$vp = $app->add(‘VirtualPage’);
$button->on(‘click’, new \atk4\ui\jsModal(‘VP Wizard’, $vp->getURL()));
$t = $vp->add(‘Wizard’);
$t->addStep(‘Step 1’, function ($p) {
$f = $p->add([‘Form’]);
// etc.
$f->setModel($etc, false);
$f->onSubmit(function ($f) use ($p) {
return $p->jsNext();
});
});
$t->addStep(‘Step 2’, function ($p) {
$f = $p->add([‘Form’]);
// etc.
$f->setModel($etc, false);
$f->onSubmit(function ($f) use ($p) {
return $p->jsNext();
});
});

Everything appears to work when I push the button – a modal window with the wizard in it appears, and it starts on the first step. However, once I click the “Next” button it gets rid of the modal window and takes me to the next step of the wizard, but in the main page instead of the popup window.