How do you create a link to a modal dialog?
This html looks ok, but did you include the core/drupal.dialog.ajax js library that attach event to your link ?

In twig :

{{ attach_library('core/drupal.dialog.ajax') }}


In PHP, it looks like this :

$renderArray = [
            '#title' =&gt; t('All Topics'),
            '#type' =&gt; 'link',
            '#url' =&gt; Url::fromRoute('XXX'),
            '#attributes' =&gt; [
                'class' =&gt; ['use-ajax'],
                'data-dialog-type' =&gt; 'modal',
            ],
            '#attached' =&gt; [
                'library' =&gt; ['core/drupal.dialog.ajax'],
            ],
];