Since Drupal 10.2, a new column for actions has been added in core's theme.inc template_preprocess_field_multiple_value_form.
This means the logic to disable the tabledrag if cardinality = 1 in paragraphs_preprocess_field_multiple_value_form needs to be adapted.
Here's the core commit
https://git.drupalcode.org/project/drupal/-/commit/be46dafb302ad16eeab76...
And the affected function in paragraphs.module (index is now 3, index 2 is the new actions column).
https://git.drupalcode.org/project/paragraphs/-/blob/8.x-1.17/paragraphs...
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3418303-2-paragraphs__fix_sort_and_action_columns.patch | 2.58 KB | nsavitsky |
| #2 | 3418303-1-paragraphs__fix_sort_and_action_columns.patch | 1.41 KB | hlopes |
Issue fork paragraphs-3418303
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
Comment #2
hlopes commentedPatch that removes both columns (action and order).
Comment #3
berdirComment #4
nsavitsky commented@hlopes Thank you very much for this patch and description, it helped me so much to understand what happened with paragraphs widget after 10.2 update.
So, if I understand correctly, in 10.2 we have "very special" new column for having actions. It looks like the problem is more complex than the case with cardinality = 1, because with 1.x paragraphs widget shows empty table cell (which actually breaks css/js) and shows actions in the content/title cell. I guess the correct approach will be to actually use this new cell, instead of hiding. That's why I extended the patch of @hlopes to implement this solution.
It works great with Claro.
Before patch:

After patch:

Unfortunately, it doesn't look good with Gin, because Gin shows paragraphs widget using "display:block" for table items and it has some magic css for calculating width and I don't really understand how it works (but it was broken before patch too, so it doesn't make it any worse :) ).
Comment #5
nsavitsky commentedI forgot to add patch itself. Here it goes.
Comment #7
nsavitsky commentedOuch, this is painful. The moving actions to new column obviously crashed functional testing. I'll try to find some time to update tests if my fix makes sense.
Comment #8
recrit commentedthe patch in #2 fixed the issue for me.
Comment #9
hudriI've been testing a bit, the changes from #1038316 broke a lot of things in Paragraphs. I'm currently getting best results with patch from #2, in multi-lingual and nested scenarios. The patch from #5 has issues with nested paragraphs, in my case the < table >'s expanded horizontally far beyond the container < div >.
I still have a minor horizontal overlap, which is quite nasty on node edit forms, because the paragraph UI buttons now overlap from
.layout-region-node-maininto the sidebar.layout-region-node-secondary, which makes them unclickable with the mouse.My quick and dirty hack for this was adding
to the admin theme
Does NOT solve the issue (might even make things worse with a huge sidebar, e.g. metatags module), but at least this workaround allows my editors to use the mouse again.
Bumping status to major due the inaccessability of the UI buttons.
Comment #10
hudriComment #11
hudriComment #12
linhnm commentedPatch #2 work for me
Comment #13
budalokko commentedPatch in #2 works for me in Claro, but #5 still shows the "Collapse" button misplaced, leaving less space for the actual form fields:
Patch in #2:

Patch in #5:

Comment #14
berdirI merged #3454273: Order select shows on a translation of a paragraphs field on 10.2+ which I think resolves this, my understanding from #5 is that there is still an issue with Gin, so keeping this open to verify and address that, without regressions on Claro which the patch there apparently has.
Extending tests would also be useful.
Comment #15
hanoiiI use Gin on most of my projects and #3454273: Order select shows on a translation of a paragraphs field on 10.2+ definitely sorted it out also on Gin.
Comment #16
nsavitsky commented@berdir I just tested version 1.18 with Claro and it definitely looks better than it was before. Not ideal, unfortunately, because we still have issue with empty table cells (see screenshot below), but it doesn't catch your eye.
Comment #17
tame4tex commentedAs @nsavitsky confirmed this is not completely fixed.
template_preprocess_field_multiple_value_form()is automatically adding an extra table column for a form element item's'_actions'.\Drupal\Core\Field\WidgetBase::formMultipleElements()adds the'_actions'array key and populates it with the item's remove button.Given
\Drupal\paragraphs\Plugin\Field\FieldWidget\ParagraphsWidget::formMultipleElements()does not add'_actions'to its items, we end up with this extra empty column.The question is should this be fixed in core or paragraphs? Should core automatically add a column for
'_actions'without confirming that items do actually have that key?Comment #18
tame4tex commentedAdded related issue
Comment #20
tame4tex commentedAssuming this wont be addressed in core, I have added a MR to fix the extra empty column issue.
I have refactored
paragraphs_preprocess_field_multiple_value_formquite a bit in an attempt to improve readability and improve robustness.I have manually tested on both paragraph widget types and all looks to be ok.
Comment #21
tame4tex commentedComment #22
er.garg.karanI have updated to the latest version of paragraphs i.e. 1.18. I am using the Gin theme and this issue is fixed for me.
Comment #23
berdirphpstan correctly points out that there is an undefined $value variable.
Comment #24
tame4tex commentedUndefined $value variable fixed. Back to NR.
Comment #25
davidiio commentedWe successfuly applied this issue merge request plain diff as a patch on drupal 10.2.7 with paragraphs 1.19
Issue is fixed for us.
Thanks
Comment #26
tame4tex commentedThere is a failing test on the MR
\Drupal\Tests\paragraphs\FunctionalJavascript\ParagraphsStableEditPerspectivesUiTest::testEditPerspectives. But when I run the test locally it passes. The same test is also failing on the MR for #3529888: Entity form modes 'description' field can no longer be an empty string, so I believe it is an issue with the test and unrelated to this code change.Comment #27
tame4tex commentedComment #28
berdirThanks, reproduced now and verified the fix, merging.