Problem/Motivation

When using the Paragraph's stable widget allowing for multiple paragraphs to be created, there is an empty <th> being added to the table.

<thead>
  <tr>
    <th colspan="2" class="field-label">
      <h4 class="label form-required-on-publish">Contacts</h4>
      <div class="paragraphs-actions">
        <div class="paragraphs-dropdown" data-once="paragraphs-dropdown">
          <button class="paragraphs-dropdown-toggle">
            <span class="visually-hidden">Toggle Actions</span>
          </button>
          <div class="paragraphs-dropdown-actions">
            <input
              class="field-dragdrop-mode-submit paragraphs-dropdown-action button js-form-submit form-submit"
              data-drupal-selector="field-contacts-dragdrop-mode"
              formnovalidate="formnovalidate"
              type="submit"
              id="field-contacts-dragdrop-mode"
              name="field_contacts_dragdrop_mode"
              value="Drag &amp; drop"
              data-once="drupal-ajax"
            />
          </div>
        </div>
      </div>
    </th>
    <th></th>
    <th class="tabledrag-hide" style="display: none">Order</th>
  </tr>
</thead>

WAVE Screenshot:
WAVE test highlighting empty table header

Steps to reproduce

Create an entity reference for paragraphs, when in the editor view review the code for the table header or leverage the WAVE tool.

Proposed resolution

Ideally we would resolve what is causing the empty header in the first place as it seems to be directly related to the 'Show Row Weights' button controls, but as a workaround I've found that hiding the incorrect header row at the end of paragraphs_preprocess_field_multiple_value_form seems to resolve the issue for now. This is not a long term solution and will need to be resolved.

CommentFileSizeAuthor
Screenshot 2024-09-05 at 3.53.31 PM.png34.43 KBjldust

Issue fork paragraphs-3472439

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

jldust created an issue. See original summary.

jldust’s picture

Issue summary: View changes
jldust’s picture

Status: Active » Needs review
jldust’s picture

Issue summary: View changes
robcarr’s picture

Thanks Jennifer - your patch seems to solve the empty TH cell problem.

mgifford’s picture

This seems like a good approach.

berdir’s picture

Status: Needs review » Needs work

this needs a rebase after the OOP hook conversion.