Skip to content

Fix: Handle data-nested="false" correctly in draggable list #47675#47689

Open
RiteshGite wants to merge 2 commits intojoomla:5.4-devfrom
RiteshGite:fix/isNested-boolean-conversion
Open

Fix: Handle data-nested="false" correctly in draggable list #47675#47689
RiteshGite wants to merge 2 commits intojoomla:5.4-devfrom
RiteshGite:fix/isNested-boolean-conversion

Conversation

@RiteshGite
Copy link
Copy Markdown

@RiteshGite RiteshGite commented Apr 26, 2026

Pull Request resolves #47675

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

Fixed the isNested variable to properly handle data-nested="false" attribute by converting the string value to a boolean.

Testing Instructions

  1. Set data-nested="false" on a draggable table
  2. Try to drag and drop rows
  3. Verify that sorting works correctly
  4. Test with data-nested="true" to ensure nesting still works

Actual result BEFORE applying this Pull Request

When 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.

Expected result AFTER applying this Pull Request

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';

Link to documentations

When data-nested='false' is set, the sorting functionality does not work
because the value is stored as a string 'false', which is truthy in JavaScript.

This fix explicitly converts the string to a boolean by comparing it with 'true'.

Fixes joomla#47675
@joomla-cms-bot joomla-cms-bot added NPM Resource Changed This Pull Request can't be tested by Patchtester PR-5.4-dev labels Apr 26, 2026
@BeginnerJoomlaCom
Copy link
Copy Markdown

Please use the Pull Request-Template.

@richard67 richard67 added the bug label Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug NPM Resource Changed This Pull Request can't be tested by Patchtester PR-5.4-dev

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The draggable script does not work correctly when data-nested="false" is set.

4 participants