Open Jemt opened 1 year ago
One could argue that it works as expected. DropDownMaxHeight(-1) means assume the height necessary to show all items. But on the other hand DetectBoundaries(..) means "do not exceed boundaries". It comes down to which of the two properties should win. But it is odd that DetectBoundaries(..) takes precedence when DropDownMaxHeight is 9999, but not when its value is -1. In any case, this is a minor problem.
Consider the following example:
https://jsfiddle.net/o3t8pnhk/4/
HTML
StyleSheet
JavaScript
DropDown will exceed its boundaries when DropDownMaxHeight(-1) is set. If we instead assign it a very high value such as 9999, then everything works fine.
Cause of error can be found here: https://github.com/Jemt/Fit.UI/blob/ade73e731e9e4dbfba5abbbfd7296588c3ca82ba/Controls/DropDown/DropDown.js#L2477
When we replace the variables, it becomes obvious why it fails. -1 will never be greater than spaceAvailable, e.g. 123:
if (picker !== null && (maxHeight.Unit !== "px" || maxHeight.Value > spaceAvailable))
if (picker !== null && ("px" !== "px" || -1 > 123))