react-range icon indicating copy to clipboard operation
react-range copied to clipboard

Direction.Down and arrow keys

Open pomber opened this issue 5 years ago • 5 comments

Hi! In the Down direction example the down arrow key goes up and the up arrow key goes down. Is that intentional?

pomber avatar May 10 '20 14:05 pomber

It is intentional according to the spec.

Down Arrow: Decrease the value of the slider by one step.

Although, there is a note:

some circumstances, reversing the direction of the value change for the keys specified above, e.g., having Up Arrow decrease the value, could create a more intuitive experience.

Not sure if it's worth to introduce the breaking change now.

tajo avatar May 11 '20 18:05 tajo

Hm 🤔, I interpret that the circumstances from the note are exactly the cases where you use Direction.Down. I find the current behavior very counterintuitive.

I understand if a breaking change is not worth it, and if adding yet another flag just for this case is too much.

Maybe something more general, like a way to override the INCREASE_KEYS and DECREASE_KEYS?

pomber avatar May 11 '20 18:05 pomber

maybe rather revertKeys={true} ?

tajo avatar May 11 '20 19:05 tajo

maybe rather revertKeys={true} ?

would that revert all keys? or just vertical keys?

Another option is to add a new Direction

pomber avatar May 11 '20 19:05 pomber

Hm, it gets more complicated because there is a left direction and also all 4 directions can be flipped with dir=rtl.

Also, when using horizontal (left/right) directions should ArrowUp always increase/decrease the value? What is intuitive there? There is also PageUp/PageDown.

I guess my idea is that revertKeys would flip ArrowUp/Down for vertical directions and ArrowLeft/Right for horizontal...

tajo avatar May 11 '20 22:05 tajo