Thank you so much for this thread - it solved a thorny issue for me with developing for Joomla 4. I had used behavior.modal which I think was a MooTools function. It no longer worked.
I have a function that shows a download link and terms and conditions as a popup prior to download.
For the group I'm posting my code - of course some of the variables are filled within my class/function.
$downloadlink = '<a href="#modal-test-modal" data-bs-toggle="modal" class="btn btn-default btn-small btn-sm">
'.$download_image.'</a>';
$modalParams = array(
'title' => Text::_('JBS_TERMS_TITLE'),
'closeButton' => true,
'height' => '300px',
'width' => '300px',
'backdrop' => 'static',
'keyboard' => true,
'modalWidth' => 30,
'bodyHeight' => 30,
'footer' => '<div class="alert alert-info">'.Text::_('JBS_TERMS_FOOTER').'</div>'
);
$modalBody = '<div class="alert alert-success">'.$params->get('terms').'<a href="index.php?option=com_proclaim&task=CWMSermons.download&id='.$media->study_id.'&mid=' . $media->id . '">'
. Text::_('JBS_CMN_CONTINUE_TO_DOWNLOAD') . '</a></div>';
$downloadlink .= HTMLHelper::_('bootstrap.renderModal', 'modal-test-modal', $modalParams, $modalBody);
Of course - above the classname in my helper file I have:
use Joomla\CMS\HTML\HTMLHelper;