If the first button of a drop down uses ajax it doesn't work and breaks ajax for subsequent links. A simple setup to reproduce as follow.

1. Add operation links to a node or a view
2. Ensure the operation links has at least 2 link
3. Make these links use ajax modal dialog
4. Click on the first link that's visible

The link will open in a new page as oppose to a modal. If I remove the modal from the first link the subsequent ajax links will work:

image of delete flow

The error is from core's ajax.js looking for a url on the button

core/misc/ajax:189

if (!this.url) {
      var $element = $(this.element);
      if ($element.is('a')) {
        this.url = $element.attr('href');
      } else if (this.element && element.form) {
        this.url = this.$form.attr('action');
      }
    }

Because the button is not wrapped in a form it doesn't satisfy either of those condition.

error message

My current thought on a solution is to wrap the button in a link that sets the url/link as the action, but not sure if this is the best approach.

Image of the first link.

first button

CommentFileSizeAuthor
#2 3100472-buttons.png135.04 KBjerrylow
delete.gif651.26 KBjerrylow
error.png50.81 KBjerrylow
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jerrylow created an issue. See original summary.

jerrylow’s picture

Issue summary: View changes
FileSize
135.04 KB
jerrylow’s picture

Actually it seems like this patch would fix the issue https://www.drupal.org/project/drupal/issues/2922677