Problem/Motivation

Error showing horizontal tabs

Error jquery is Uncaught TypeError: Cannot read properties of undefined (reading 'attach')

Update drupal 9.4.1 to drupal 9.4.2 and display error

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Nelo_Drup created an issue. See original summary.

nelo_drup’s picture

Update reviewing the error a little more, I verify that the horizontal-tabs.js file does not have the necessary context to search for the following attributes in:

$(context).find('[data-horizontal-tabs]').once('horizontal-tabs').each(function() {}

That's why nothing is found in

if (!$($details[0]).hasClass('.collapse-processed')) {
Drupal.behaviors.collapse.attach(context);
}

Webbeh’s picture

Issue tags: -javascript error

Removing tag.

alex.skrypnyk’s picture

Version: 8.x-3.2 » 8.x-3.x-dev
Priority: Normal » Critical
Issue tags: +Drupal 10 compatibility
Related issues: +#3297196: Automated Drupal 10 compatibility fixes

Tested this on Drupal 10-beta2

The Hotizontal tabs not working at all and the current JS code relies on `collapse.js` which was removed in D10 - https://www.drupal.org/node/3269082 (change record https://www.drupal.org/node/3285858)

The original Drupal 10 compatibility issue (https://www.drupal.org/project/field_group/issues/3297196) was closed with a comment that `3.x` already works with D10, but that issue has not addressed this depreciation unfortunately.

Leaving this open, tagging and linking D10 compat issue.

swentel’s picture

Priority: Critical » Major
Status: Active » Postponed (maintainer needs more info)

Interesting, this works fine here on my local D10 environment, so bit confused.

at least, in the backend it works, how can I reproduce this?

smustgrave’s picture

Tested on a local 9.5 environment
Using claro as my admin theme (as that is now the default)

Latest version of Field group
Created a tabs group
Created 2 tab groups
Added a field under each

Verified the tabs are working fine.

Since this was only moved to PNMI 12 days ago won't close as cannot reproduce but +1 for that.

Would request specific steps for reproducing this issue

alex.skrypnyk’s picture

Status: Postponed (maintainer needs more info) » Needs review

To reproduce:
1. Install D10 beta2 with Claro enabled as an admin theme
2. Install Field Group from 3.x-dev
3. Create fields in content type and place them in the hotizontal tabs
4. Navigate to the content type edit form and observe the error.

In D10 there is no more `collapse.js` as it has been removed from core - see https://www.drupal.org/node/3285858

The MR is removing these lines:

          // If collapse.js did not do his work yet, call it directly.
          if (!$($details[0]).hasClass('.collapse-processed')) {
            Drupal.behaviors.collapse.attach(context);
          }

`Drupal.behaviors.collapse` does not exist anymore in D10.

It may be that some themes use `collapse--processed` instead of `collapse-processed` class and this code is not fired.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Ah there it is.

Thanks for the detailed steps.

swentel’s picture

Hmm yeah, I see it now as well, and works again with those lines removed, so great!

@smustgrave did you test on D9 with those lines remove, just double checking?

smustgrave’s picture

Did not test in D9 with the patch. Suppose if the removal causes issues we can just wrap the whole thing in an if check

swentel’s picture

Status: Reviewed & tested by the community » Fixed

Was able to test myself quickly, still works fine on D9 too (even on D9.2 and D9.1)

merged, thanks!

Status: Fixed » Closed (fixed)

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