User tests: Successful: Unsuccessful:
Pull Request resolves #47675
Fixed the isNested variable to properly handle data-nested="false" attribute by converting the string value to a boolean.
data-nested="false" on a draggable tabledata-nested="true" to ensure nesting still worksWhen data-nested="false" is set, drag-and-drop sorting does not work because the string "false" is treated as truthy in JavaScript, causing the condition if (isNested) to incorrectly evaluate to true.
Both data-nested="true" and data-nested="false" work correctly. The fix explicitly converts the dataset string value to a boolean using isNested = container.dataset.nested === 'true';
| Status | New | ⇒ | Pending |
| Category | ⇒ | JavaScript Repository NPM Change |
| Labels |
Added:
NPM Resource Changed
bug
PR-5.4-dev
|
||
| Title |
|
||||||
Thanks for your Contribution @RiteshGite.
Could you please give us more explained( a bit in detail) Testing Instruction to test this PR?
@RiteshGite Technically, your fix is correct. However, changing this behavior now could cause many views in Joomla core (such as Categories, Menu Items, Modules, etc.) to suddenly stop working as expected, because they currently use data-nested="false" in places where it should be data-nested="true".
A few examples:
https://github.com/joomla/joomla-cms/blob/5.4-dev/administrator/components/com_categories/tmpl/categories/default.php#L130
https://github.com/joomla/joomla-cms/blob/5.4-dev/administrator/components/com_menus/tmpl/items/default.php#L105
So at the moment, this JS bug actually allows buggy core code (and probably some third-party extensions as well) to continue working as expected :)
I think the safer approach would be:
Thanks for the guidance!
I've created PR #47780 which addresses the first step you mentioned.
This PR fixes the data-nested attributes in Categories and Menu Items
components that have parent-child hierarchies.
Once this PR is merged, the JavaScript fix in this PR (#47689) can be
safely applied without breaking any existing functionality.
The approach:
Looking forward to your review!
Thanks for the feedback!
I've added more detailed testing instructions in the related PR #47780, covering step-by-step testing for nested drag-and-drop behavior in Categories, Menu Items, and Modules.
Please let me know if you think more scenarios should be covered.
Hi @RiteshGite
Change on this PR is counted backward incompatible, so the earliest version we can make this change is Joomla 7. For the time being, I would suggest we fix wrong usages of data-nested in our core code (as you did in PR #47780), and worry about this later (I saw somewhere we might switch to use a different library for drag and drop in J7)
@joomdonation Understood.
We'll keep the core data-nested fixes in #47780 for now, and revisit the JS behavior change later if needed.
Please use the Pull Request-Template.