The visual of the field is broken in Drupal 10.2.0

Created on 22 December 2023, 6 months ago
Updated 9 February 2024, 5 months ago

Problem/Motivation

I upgraded my website from 10.1.7 to 10.2.0 and i got a visual error on administration

Steps to reproduce

1. Creates a content type with a referenced field (taxonomy) with an allowed number of values set to "Unlimted" or at least "2"
2. Upgrade your website to Drupal 10.2.0
3. Try to create a content
4. You should see exactly the same issue as me (Drag and drop with the order field and the "Show row weights" button is missing)

Proposed resolution

Simply change the colspan value from 2 to 3

Expected result

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇫🇷France bakop Lille

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

Merge Requests

Comments & Activities

  • Issue created by @bakop
  • 🇫🇷France bakop Lille

    bakop changed the visibility of the branch 3410535-the-visual-of to hidden.

  • 🇫🇷France bakop Lille

    bakop changed the visibility of the branch 3410535-the-visual-of to active.

  • Issue was unassigned.
  • Status changed to Needs review 6 months ago
  • 🇫🇷France bakop Lille

    Patch sent as merge request (MR!9) !
    It works only for version >=10.2.0 so a new release should be published.

  • 🇯🇴Jordan Ahmad Khader

    I can confirm that this is causing tabledrag.js to not work properly and is throwing an Uncaught TypeError: Cannot read properties of undefined (reading 'colSpan')

    @bakop, we could change the PR to follow the normal core behavior by adding an empty tr tag.

        $header = [
          [
            'data' => [
              '#prefix' => '<h4' . $header_attributes . '>',
              '#markup' => $element['#title'],
              '#suffix' => '</h4>',
            ],
            'colspan' => 2,
            'class' => ['field-label'],
          ],
          [],
          t('Order', [], ['context' => 'Sort order']),
        ]; 

    What do you think?

  • Status changed to Needs work 6 months ago
  • 🇺🇸United States markdorison

    I just left a comment with an idea on how to not drop support for versions < 10.2 and there is a different idea presented in #7. Marking this as needs work so we can see what else we can come up with.

  • Assigned to bakop
  • Status changed to Active 6 months ago
  • Issue was unassigned.
  • Status changed to Needs review 6 months ago
  • 🇫🇷France bakop Lille

    Hello, you are both right. I modified and tested the code on versions 10.1.7 and 10.2.1

  • 🇯🇴Jordan Ahmad Khader

    thanks @bakop
    I can also confirm that the code worked on 10.2.1.

  • 🇺🇸United States markdorison

    I pushed a revision that I believe should accomplish the same thing, but without duplicating the entire $header array. There may be a more elegant way to do this but this was my best idea so far. Could you test to ensure this approach resolves the issue?

  • 🇮🇳India Sandeep_k New Delhi

    I've Tested this on a freshly installed Drupal version- 10.2.2-dev & able to reproduce this issue there as well. After reproducing this I've applied the shared patch MR !9 mergeable successfully and it looks good to me.

    Testing Steps:

    1. Set up a Drupal 10.2
    2. Enable/Install the Require on Publish module
    3. Creates a content type with a referenced field (taxonomy) Select 'Required on Publish' with an allowed number of values set to "Unlimted" or at least "2"
    4. Create a node> for the newly created content type.
    5. Scroll down to the referenced field (taxonomy)- Shared before result.
    6. Download the shared patch & apply.
    7. Go to> Newly created content type> Scroll down to the referenced field (taxonomy) and re-verify this.

    Testing Results:
    After applying the patch, the "Show row weights" button is present now. RTBC+

  • Status changed to RTBC 5 months ago
  • 🇩🇪Germany stBorchert

    Thanks for the patch. We stumbled across this issue after updating to Drupal 10.2 and all paragraph forms were broken.
    Without the patch you'll get the following javascript error:
    Cannot read properties of undefined (reading 'colSpan')

  • Pipeline finished with Skipped
    5 months ago
    #82802
  • Status changed to Fixed 5 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024