Problem/Motivation

After upgrading from 3.0.x to 4.0.x we noticed the weights were being displayed, even if they were supposed to be hidden.

Steps to reproduce

Upgrade from 3.0.x to 4.0.x.

Proposed resolution

Revert code causing the issue.

CommentFileSizeAuthor
#2 3543823-2.patch590 bytesmichaelsoetaert
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

michaelsoetaert created an issue. See original summary.

michaelsoetaert’s picture

StatusFileSize
new590 bytes
michaelsoetaert’s picture

Status: Active » Needs review
bvoynick’s picture

What version of Drupal core? That might be helpful to know. I believe this change was added to support newer versions of core.

michaelsoetaert’s picture

We're currently on drupal/core:10.3.10. We noticed the issue while preparing our upgrade to drupal/core:^11. It could indeed be this patch is not needed anymore once we've completed our upgrade.

stefan.korn’s picture

MR using solution from @abramm to hopefully provide a D10/D11 compatible solution:
https://www.drupal.org/project/field_config_cardinality/issues/3454609#c...

dzinkevich’s picture

I tested this patch with Drupal 10.5.4 and 10.5.6 and it works with both.

For the record, this patch ALSO fixes the issue on the same where the weight handles didn't appear, which makes sense looking at the issue and tracking down how tabledrag.js works.

For testing, we were able to reproduce this by testing with fields that were paragraphs; for these, the table name is not the same as the field name that core uses.

Thanks so much everyone!

natemow’s picture

I think this patch is much more critical than what's been described to date...without it, tabledrag was completely broken for me, whether using Claro or Gin (which has tabledrag.js overrides). My stack is core 10.6.3, paragraphs_browser 1.3 (using the "experimental" widget...though "classic" yielded the same error).

Pre-patch, I was getting this in the console:

tabledrag.js?v=10.6.3:525 Uncaught TypeError: Cannot read properties of undefined (reading 'matches')
    at tabledrag.js?v=10.6.3:525:22
    at Array.map (<anonymous>)
    at Drupal.tableDrag.rowSettings (tabledrag.js?v=10.6.3:522:8)
    at Drupal.tableDrag.updateField (tabledrag.js?v=10.6.3:1083:28)
    at tabledrag.js?v=10.6.3:1070:12
    at Array.forEach (<anonymous>)
    at Drupal.tableDrag.updateFields (tabledrag.js?v=10.6.3:1067:43)
    at Drupal.tableDrag.dropRow (tabledrag.js?v=10.6.3:912:14)
    at HTMLDocument.<anonymous> (tabledrag.js?v=10.6.3:311:57)
    at HTMLDocument.dispatch (jquery.min.js?v=3.7.1:2:40035)

I eventually wound up at this issue because I realized that the "field_name-delta-order" class was not being added to the last table cell (@see template_preprocess_field_multiple_value_form(), Drupal.tableDrag.prototype.rowSettings) -- the class gets removed after tabledrag.js processing has run, but without its presence initially, the drag target can't be found.

halth’s picture

Status: Needs review » Reviewed & tested by the community

Heads-up: if patch application fails with “malformed patch”, check the line endings on the downloaded .patch file. If it was saved or edited on Windows (or a tool rewrote it), it may have CRLF (\r\n) instead of Unix LF. BSD/macOS patch is picky about that and can report a malformed hunk even when the diff content is fine.

steinmb’s picture

Title: Weight column stays visible when hidden » Hidden weight column becomes visible after upgrading from 3.0.x to 4.0.x

Trying to improve the title

caesius’s picture

Status: Reviewed & tested by the community » Needs work

Neither the patch file in #2 nor the MR fix the issue for me.

Also, #11 set this issue to RTBC but described issues applying a .patch file; if the MR had been used it would've been a .diff file. The patch and the MR seem to take different approaches to resolving this bug, but to me it doesn't seem fixed anyway. I'll see if I can replicate on a fresh sandbox environment.

caesius’s picture

Status: Needs work » Reviewed & tested by the community

Nevermind; PEBKAC -- I had an extra trailing slash in my composer.patches.json file.

I've confirmed both the patch and MR resolve the issue, though the MR seems to be more thorough.