Opened 12 years ago
Closed 5 years ago
#9160 closed defect (patchwelcome)
RangeSlider: attr('value') has reversed return value in RTL mode
Reported by: | bill | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.13 |
Component: | DojoX Form | Version: | 1.3.0 |
Keywords: | bidi | Cc: | |
Blocked By: | Blocking: |
Description (last modified by )
After initializing a RangeSlider with value="0,100" or similar, attr('value') should return [0,100]
. However, in RTL mode it incorrectly returns [100,0]
.
A related bug is that attr('value', [0,100])
doesn't work correctly in RTL mode.
The cause of both bugs is that RangeSlider has the following code in postCreate():
this.value.sort(this._isReversed() ? sortReversed : sortForward);
Since _isReversed() is simply a flag for whether you are in RTL or LTR mode, that means that the value returned by attr('value') will change just because the computer is in RTL mode.
Of course, visualization details like RTL vs LTR shouldn't affect how the API operates.
Any normalization code should happen in _setValueAttr() rather than postMixInProperties(), and then maybe you could have a _getValueAttr() method too, although I wish/hope that none of this reversal code is needed.
BTW, since the values array always has exactly two values the above code can be written more simply as:
this.value = this. _isReversed() ? [ this.value[1], this.value[0] ] : [ this.value[0], this.value[1] ]
Change History (6)
comment:1 Changed 12 years ago by
comment:1 Changed 12 years ago by
Owner: | changed from dante to Nathan Toone |
---|
comment:2 Changed 12 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 12 years ago by
Milestone: | tbd → future |
---|
comment:5 Changed 5 years ago by
Milestone: | future → 1.12 |
---|---|
Resolution: | → patchwelcome |
Status: | new → closed |
Unfortunately still an issue. Given the lack of interest over the past 7 years, I'm closing it as patchwelcome. If there's interest in revisiting this please re-open with a pull request per our contribution guidelines ( https://github.com/dojo/dojo/blob/master/CONTRIBUTING.md ).
PS: this is an offshoot from #9102. The sort() was causing a separate problem, with was fixed in [17329], but that still leaves this issue.