Fix: Handle data-nested="false" correctly in draggable list #47675#47689
Open
RiteshGite wants to merge 2 commits intojoomla:5.4-devfrom
Open
Fix: Handle data-nested="false" correctly in draggable list #47675#47689RiteshGite wants to merge 2 commits intojoomla:5.4-devfrom
RiteshGite wants to merge 2 commits intojoomla:5.4-devfrom
Conversation
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
|
Please use the Pull Request-Template. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request resolves #47675
Summary of Changes
Fixed the
isNestedvariable to properly handledata-nested="false"attribute by converting the string value to a boolean.Testing Instructions
data-nested="false"on a draggable tabledata-nested="true"to ensure nesting still worksActual 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 conditionif (isNested)to incorrectly evaluate totrue.Expected result AFTER applying this Pull Request
Both
data-nested="true"anddata-nested="false"work correctly. The fix explicitly converts the dataset string value to a boolean usingisNested = container.dataset.nested === 'true';Link to documentations