Nested Tables Result in Duplicate Weight Toggles

Created on 15 August 2024, 4 months ago
Updated 17 September 2024, 3 months ago

Problem/Motivation

When draggable tables are nested and the .gin-table-scroll-wrapper is present on the outer table, the nested "Show row weights" toggles are all being moved to the outer wrapper.

This started occurring when the tabledrag.js override was added. One of the overrides is to add the weight toggles before the .gin-table-scroll-wrapper if it is present. The issue occurs because jQuery .parents() will search through all ancestors for the .gin-table-scroll-wrapper class and each nested weight toggle will be moved before the wrapper.

The normal behavior is that the nested weight toggles would be moved before their table. Claro hides these nested weight toggles since they are redundant.

Steps to reproduce

Nested draggable tables do not appear often. The place where is happens for me is when a field with unlimited cardinality is added to a Commerce product attribute.

Proposed resolution

Use .parent() instead of .parents() when checking if the .gin-table-scroll-wrapper is present. This will result in only the outer table matching the condition.

πŸ› Bug report
Status

RTBC

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mtalt Maryland

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024