New to Kendo UI for jQuery? Download free 30-day trial

Scroll TabStrip with Keyboard

Keyboard navigation requires an element to be focused. Non-form elements normally do not receive focus. To overcome this, the TabStrip <div> wrapper has a tabindex attribute. Logically, Left Arrow and Right Arrow keys switch the active tab. Up Arrow and Down Arrow keys do the same as this is what accessibility standards require. When the TabStrip wrapper has the focus, and its active content container is scrollable, then the Up Arrow and Down Arrow keys do not scroll the container even if the widget ignores these keystrokes. This is because the focused element is a parent of the scrollable one and the browser has no idea that it is supposed to scroll the child element in this situation.

There is a way to make the scrollable content container become focused: add a tabindex attribute to it. Then, scrolling with the Up Arrow and Down Arrow keys start working, but TabStrip keyboard navigation completely stops working. This is because Kendo UI TabStrip handles key events only if its wrapper is the focused element. The idea behind this behavior is that the widget is not supposed to interfere with the keyboard navigation of nested form elements, child widgets, etc.

To vertically scroll the TabStrip content containers with the help of the keyboard, do the following:

Step 1. Drop the keyboard navigation of the TabStrip altogether by removing the wrapper's tabindex after widget initialization. In this way the TabStrip is not able to receive focus and capture keyboard events.


Step 2. Scroll the container using JavaScript, as the example below demonstrates.


        #tabstrip > .k-content
            height: 200px;
            overflow: auto;


    <div id="tabstrip">
            <li class="k-state-active">
            1<br /><br /><br />2<br /><br /><br />3<br /><br /><br />4<br /><br /><br />
            5<br /><br /><br />6<br /><br /><br />7<br /><br /><br />8<br /><br /><br />
            1<br /><br /><br />2<br /><br /><br />3<br /><br /><br />4<br /><br /><br />
            5<br /><br /><br />6<br /><br /><br />7<br /><br /><br />8<br /><br /><br />

        $(document).ready(function () {
            // this handler should be attached before the TabStrip is initialized!
            $("#tabstrip").on("keydown", function (e) {
                // kendo.keys is documented at
                if (e.keyCode == kendo.keys.DOWN || e.keyCode == kendo.keys.UP) {
                    // prevent the built-in TabStrip keyboard navigation
                    // prevent page scroll
                    // get the visible TabStrip container
                    var visibleContainer = $("kendoTabStrip").wrapper.children(".k-content").filter(":visible");
                    if (e.keyCode == kendo.keys.DOWN) {
                        visibleContainer.scrollTop(visibleContainer.scrollTop() + 50);
                    } else {
                        visibleContainer.scrollTop(visibleContainer.scrollTop() - 50);

                animation: {
                    open: {
                        // the default expand animation should be replaced or disabled
                        // when the TabStrip containers have an explicit height
                        effects: "fadeIn"



See Also

For more runnable examples on the Kendo UI TabStrip widget, browse its How To documentation folder.

In this article
Not finding the help you need? Improve this article