Keyboard Interaction
20 Apr 20171 minute to read
You can use Keyboard shortcut keys as an alternative to the mouse for using the Slider widget. All options in the Slider can be accessed using keyboard shortcuts. The following table explains the keyboard shortcut keys and the operations that can be performed using the corresponding keys.
List of Keyboard shortcuts
Shortcut Key | Description |
---|---|
Alt + j | Focuses into the Slider handle |
Up/Right | Increments the Slider value |
Down/Left | Decrements the Slider value |
Home | Slider handle moves to the start value |
End | Slider handle moves to the end value |
Esc | Focuses out from the Slider handle |
Configure keyboard interaction
The following steps explains you on how to enable keyboard support in Slider.
- In an view page, specify the helper elements to render the Range Slider.
@*Add this code in your view page*@
<ej-slider id="rangeSlider" slider-type="Range" values="25,75" width="500px" />
// In JavaScript, Focus the Slider control in document key down function
<script>
$(document).on("keydown", function (e)
{
if (e.altKey && e.keyCode === 74)
{
// j- key code.
$("#rangeSlider a")[0].focus();
}
});
</script>
Run the sample and press, Alt + j keys to set focus in the Slider handle and you can handle the Slider operations using the keyboard shortcut keys.
When clicked the Alt + J key, the slider was focused.
Slider with Keyboard Interaction.