U4-10252 - Slider property editor initial values not used when equal (range enabled)

Created by Ronald Barendse 04 Aug 2017, 22:40:58 Updated by Sebastiaan Janssen 07 Aug 2017, 06:11:16

Tags: PR

The built-in Umbraco.Slider property editor does not use the correct initial values when range is enabled and both values are equal.

Steps to reproduce:

  • Add/configure Umbraco.Slider with: ** Enable range: checked ** Initial value: 50 ** Initial value 2: 50 ** Minimum value: 0 ** Maximum value: 100 ** Step increments: 1
  • Expected: 50-50, the initial values as specified
  • Actual: 50-100, the maximum value used as initial value 2

I've traced this down to line 130 of slider.controller.js: https://github.com/umbraco/Umbraco-CMS/blob/5397f2c53acbdeb0805e1fe39fda938f571d295a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/slider/slider.controller.js#L130.

sliderVal = [ isNaN(i1) ? $scope.model.config.minVal : (i1 >= $scope.model.config.minVal ? i1 : $scope.model.config.minVal), isNaN(i2) ? $scope.model.config.maxVal : (i2 > i1 ? (i2 <= $scope.model.config.maxVal ? i2 : $scope.model.config.maxVal) : $scope.model.config.maxVal) ];

Just changing i2 > i1 to i2 >= i1 would fix this bug!

Comments

Ronald Barendse 06 Aug 2017, 20:46:43

I created a pull request, so fixing this should be a trivial thing to do: https://github.com/umbraco/Umbraco-CMS/pull/2103.


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Very Easy

Category: Editor

Backwards Compatible: True

Fix Submitted: Pull request, Inline code

Affected versions: 7.6.3

Due in version: 7.6.5

Sprint:

Story Points:

Cycle: