When there's no admin menu toolbar the ultimenu throws an exception
Uncaught DrupalBehaviorError: attach ; ultimenu: t(...).find(...).once is not a functionDrupal.attachBehaviors @ js_TPAFFvtTJS4h7hFTiH-_scRePSQ22xtWEPlO7KuMt6U.js:222(anonymous function) @ js_TPAFFvtTJS4h7hFTiH-_scRePSQ22xtWEPlO7KuMt6U.js:227n.addEventListener.t @ js_TPAFFvtTJS4h7hFTiH-_scRePSQ22xtWEPlO7KuMt6U.js:4

The user is not able to expand the hamburger menu.

Exception thrown on this function:

  Drupal.attachBehaviors = function (context, settings) {
    context = context || document;
    settings = settings || drupalSettings;
    var errors = [];
    var behaviors = Drupal.behaviors;
    // Execute all of them.
    for (var i in behaviors) {
      if (behaviors.hasOwnProperty(i) && typeof behaviors[i].attach === 'function') {
        // Don't stop the execution of behaviors in case of an error.
        try {
          behaviors[i].attach(context, settings);
        }
        catch (e) {
          errors.push({behavior: i, error: e});
        }
      }
    }
    // Once all behaviors have been processed, inform the user about errors.
    if (errors.length) {
      throw new DrupalBehaviorError(errors, 'attach');
    }
  };

Comments

jclopez created an issue. See original summary.

gausarts’s picture

Assigned: jclopez » Unassigned
Status: Active » Postponed (maintainer needs more info)

Thanks for the report.

Could you provide more info what Drupal version you are using? And what profile, Standard or Minimal?

The module was tested against beta14 and the latest Dev I picked up last week and I have no such issue so far. Not sure yet about the latest one since last week onward.

I also uninstalled contrib admin_toolbar and core toolbar, and haven't been able to re-produce it yet since maybe I used the Standard profile, not Minimal one.

Most likely it is a dependency issue.

If that is the case, could you please open ultimenu.libraries.yml, add extra lines as shown below after # Add explicit dependency line:

ultimenu:
  version: VERSION
  js:
    js/ultimenu.min.js: {}
  css:
    theme:
      css/ultimenu.css: {}
  dependencies:
    - core/jquery
    - core/drupal
    # Add explicit dependency.
    - core/drupalSettings
    - core/jquery.once

Be sure to clear cache admin/config/development/performance, and maybe regenerate JS for just in case.
Please let me know if that solves it, so we can add it there.

jclopez’s picture

Right now I'm on drupal 8.0.0-beta14 with a standard profile, I tried with ultimenu version 8.x-1.0 and also with the DEV version and both were not working.

I added the extra dependencies on ultimenu.libraries.yml and cleared cache, now the hamburger menu is working when there isn't an Admin toolbar menu, this is on the ultimenu DEV version.

Thank you

gausarts’s picture

Status: Postponed (maintainer needs more info) » Postponed

Ok, thanks for the update. Will add the fix once I get a chance to get back to it.

gausarts’s picture

Title: User not able to expand hamburger menu, Uncaught DrupalBehaviorError: attach ; ultimenu » JS errors due to unmet jquery.once and drupalSettings dependencies

  • gausarts committed b8cc24f on 8.x-1.x
    Issue #2562829 by jclopez: JS errors due to unmet jquery.once and...
gausarts’s picture

Status: Postponed » Fixed

Pushed to Dev. Thanks a lot.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.