How to open a popup form from a view link? I'm really struggling with this issue.
Well I'm having a view, in this view a field configured as personalized text as a link.
I want to open a popup form on click on the link.
Here is what I did in the method called by the link:

 $response = new AjaxResponse();
  $title = 'Title for the Popup.';
  $form['#attached']['library'][] = 'core/drupal.dialog.ajax';
  $response-&gt;setAttachments($form['#attached']);
  $content = '&lt;div class="test-popup-content"&gt;' . 'Content in HTML format' . '&lt;/div&gt;';
  $options = array(
    'dialogClass' =&gt; 'popup-dialog-class',
    'width' =&gt; '75%',
  );
  $modal = new OpenModalDialogCommand($title, $content, $options);
  $response-&gt;addCommand($modal);
  return $response; 


But It's not working at all!
Please help!
Your code is building an ajax response. This only works in ajax callbacks, nowhere else.

If you want to make a link modal, so that it will open in a popup, you have to set the class use-ajax and the attribute data-dialog-type. Like in this example from ConfigSync.php:

$links['view_diff'] = [
  'title' =&gt; $this-&gt;t('View differences'),
  'url' =&gt; Url::fromRoute($route_name, $route_options),
  'attributes' =&gt; [
    'class' =&gt; ['use-ajax'],
    'data-dialog-type' =&gt; 'modal',
    'data-dialog-options' =&gt; json_encode([
      'width' =&gt; 700,
    ]),
  ],
];


For modal links to work you need to attach a library, see How to create modal windows (pop-ups)?