Ajax modal does not show for authenticated users I'm testing a simple ajax modal link on a Drupal site and figured out that the modal

&lt;a class="use-ajax" data-dialog-type="modal" href="/search/node"&gt;Search&lt;/a&gt;


does only show when logged in as admin. For authenticated users it does not load (it just shows the search page). This is independent of the underlying theme I am using (bartik or a bootstrap subtheme). No error messages or status-reports give any indication what's going on. I thought only for anonymous users ajax needs to be added for the theme dependencies ? What am I missing here ?
For use-ajax to work for Anonymous as well as Authenticated user, Core core/drupal.ajax library must need to be loaded on page, where we're using 'use-ajax' class.

You can include this library with either using #attached in your Form or Controller or you can implement hook_page_attachments hook and attach ajax library.

If you're trying to add link to text inside your form, you can directly use #ajax instead of using classes as per directed in Ajax commands for opening and closing Dialogs and generic Dialog Controller added to core

  $form['link'] = [
    '#type' =&gt; 'link',
    '#title' =&gt; 'Link 1 (modal)',
    '#url' =&gt; Url::fromRoute('ajax_test.dialog_contents'),
    '#ajax' =&gt; [
      'dialogType' =&gt; 'modal',
    ],
  ];


Hope this helps.