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:
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.
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3100472-buttons.png | 135.04 KB | jerrylow |
delete.gif | 651.26 KB | jerrylow | |
error.png | 50.81 KB | jerrylow |
Comments
Comment #2
jerrylow CreditAttribution: jerrylow at Myplanet commentedComment #3
jerrylow CreditAttribution: jerrylow at Myplanet commentedActually it seems like this patch would fix the issue https://www.drupal.org/project/drupal/issues/2922677