First button of dropdown with ajax doesn't work

Created on 11 December 2019, about 5 years ago
Updated 13 September 2024, 4 months ago

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.

🐛 Bug report
Status

Closed: won't fix

Version

3.0

Component

Code

Created by

🇨🇦Canada jerrylow

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024