Slider property editor: Fix for preset value handling of enableRange#20772
Conversation
Updated the `UmbSliderPropertyValuePreset` class to ensure the `.value` property is accessed for configuration items. This change improves the accuracy of retrieving `enableRange`, `min`, `max`, and `step` values, addressing potential bugs in value processing.
|
Hi there @Luuk1983, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the slider property value preset where configuration values were being accessed incorrectly. The code was attempting to use entire DataTypePropertyPresentationModel objects as fallback values instead of accessing their .value property.
Key Changes:
- Fixed
enableRangeconfig access to use.valueproperty (line 9) - Fixed
stepconfig access to use.valueproperty and wrapped inNumber()for type consistency (line 18) - Updated commented-out code for
minandmaxto follow the corrected pattern (lines 12-13)
AndyButland
left a comment
There was a problem hiding this comment.
Thanks @Luuk1983 for reporting and providing the fix. I can see the error here as you've identified, and that your fix will now correctly retrieve the value. I've verified also that it does.
enableRange
enableRangeenableRange
Prerequisites
This fixes #20771
Description
This fixes an issue where a slider data type would incorrectly give validation errors when publishing a content node. The value presets of the slider do not correctly handle the enableRange setting which caused it to be always true if the enabledRange property is in the configuration, regardless of it's value.
The steps setting was also incorrectly handled (it would always be 1), although that impact is extremely limited because it's only used in a fallback scenario.
I think that the steps to reproduce are clear in the associated issue, otherwise I'm happy to provide more details.