Stop propogation on activeTagsRemove like activeTagsAdd

Created on 26 August 2014, about 10 years ago
Updated 9 August 2024, 3 months ago

The onclick methods that fire when you add a tag return "false" like so:

Drupal.behaviors.activeTagsAdd = {
  attach: function (context, settings) {
    $('input.at-add-btn:not(.activeTagsAdd-processed)', context)
      .addClass('activeTagsAdd-processed')
      .each(function () {
        $(this).click(function (e) {
          var tag = $(this).parent().find('.at-term-entry').val().replace(/["]/g, '');
          if (Drupal.settings.activeTags.mode === 'csv') {
            activeTags.addTerms(this, tag);
          }
          else {
            // Default to single tag entry mode.
            activeTags.addTerm(this, tag);
          }
          return false;
        });
      });
  }
};

This keeps other click functions from firing and creating unexpected behavior.

Can we add the same return false to activeTagsRemove like so?

Drupal.behaviors.activeTagsRemove = {
  attach: function (context, settings) {
    $('div.at-term-remove:not(.activeTagsRemove-processed)', context)
      .addClass('activeTagsRemove-processed')
      .each(function () {
        $(this).click(function () {
          activeTags.removeTerm(this);
          return false;
        })
      });
  }
};

In my case, I've added the node edit form to a foundation dropdown that closes if you click off the dropdown. However, removing a tag is also closing the modal.

I realize it's a pretty edge case, and my knowledge of js isn't strong enough to know if this is excluded for a specific reason, so I'm setting this as a feature request. Will include a patch in the next post.

✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mariacha1

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.

  • πŸ‡΅πŸ‡±Poland mahyarss

    Thank you for your continued interest in the Active Tags β†’ module.

    We are excited to announce that the issue you raised has been addressed in the revitalized Active Tags version 1.0.0. This update supports Drupal 9, 10, and 11 and brings a modern interface along with a range of new features to enhance your Drupal tagging experience, including:

    • Enhanced Tag Styling: Enjoy a modern and visually appealing interface for entity reference fields.
    • Dynamic Tag Creation: Flexibly enable or disable tag creation based on your Drupal settings.
    • Support for User Avatars: Display user avatars in tags when using the User entity autocomplete.
    • Efficient Tag Management: Organize tags effortlessly with drag-and-sort functionality, duplicate protection, and multiple selection support.
    • Entity ID Display: Optionally display the entity ID alongside each tag for added clarity.
    • Integration with Key Modules: Seamlessly integrate with Token, Webform, Facets, and Better Exposed Filters for enhanced filtering and autocomplete functionality.

    This is just a glimpse of the new capabilities. We encourage you to explore these new features by downloading the latest version. For a full list of features and more details, please visit the Active Tags project page β†’ .

  • Status changed to Fixed 3 months ago
  • πŸ‡΅πŸ‡±Poland mahyarss

    With the release of Active Tags 1.0.0, we believe this issue has been fully resolved. We invite you to explore the latest version and share any feedback you have.

    Thank you for your continued support and contributions to the Drupal community. Together, we can keep improving Active Tags!

    Visit the Active Tags project page β†’ to stay updated and provide feedback.

Production build 0.71.5 2024