New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Keyboard Support

  • ASP.NET controls
    • RadMenu
    • RadTabStrip
    • RadPanelBar
    • RadTreeView
  • WinForms controls
    • RadMenustrip
    • RadTabStrip
    • RadToolStrip
  • Other projects
    • SiteFinity
    • Reporting
    • RadAjax
  • Demo Configurator
  • Command keyAlt

Keyboard support

A critical requirement for software accessibility is keyboard support as a complete alternative to pointing devices (mouse, etc.).

Keyboard support is comprised of command key, focus key, and keyboard navigation. RadPanelBar will seamlessly switch between mouse and keyboard navigation.

In order to configure keyboard support with RadPanelBar its KeyboardNaviagationSettings should be set:

<telerik:RadPanelBar ID="RadPanelBar1" runat="server" >
    <KeyboardNavigationSettings CommandKey="Alt" FocusKey="M" />
</telerik:RadPanelBar>
    

The KeyboardNavigationSettings exposes two properties to configure the keyboard combination that sets focus to the control:

  • FocusKey: An upper-case letter or number.
  • CommandKey Ctrl , Alt, Shift, or any combination of two of these keys.

When there are multiple PanelBars on a given page, each of them may have a different activation combination.

In this particular example, the [CommandKey] and the [FocusKey] can be customized in the Demo Configurator.

Once the RadPanelBar is focused (by pressing [CommandKey] + [FocusKey]):

  • Navigate among items using Down and Up arrows.
  • Select (trigger click on) item by pressing Enter, when item is active.
  • Expand/Collapse sub-item list of an item by pressing Space.
  • Press Ctrl + Up arrow to move to parent.
  • Press Home to focus the first sibling item.
  • Press End to focus the last sibling item.

Note: It is recommended to avoid [CommandKey] + [FocusKey] combinations matching keyboard shortcuts used in browsers. If the combination coincides with an existing browser shortcut the control may be unable to focus.

  • DefaultVB.aspx
  • DefaultVB.aspx.vb
<%@ Page Title="" Language="VB" AutoEventWireup="true" CodeFile="DefaultVB.aspx.vb" Inherits="PanelBar.Examples.Functionality.KeyboardSupport.DefaultVB" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
</head>

<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />

    <div class="demo-container size-thin">
        <telerik:RadPanelBar RenderMode="Lightweight" runat="server" ID="RadPanelBar1" TabIndex="1" Width="100%" Height="300" ExpandMode="FullExpandedItem">
            <Items>
                <telerik:RadPanelItem Expanded="True" Text="ASP.NET controls">
                    <Items>
                        <telerik:RadPanelItem Text="RadMenu" />
                        <telerik:RadPanelItem Text="RadTabStrip" />
                        <telerik:RadPanelItem Text="RadPanelBar" />
                        <telerik:RadPanelItem Text="RadTreeView" />
                    </Items>
                </telerik:RadPanelItem>
                <telerik:RadPanelItem Text="WinForms controls">
                    <Items>
                        <telerik:RadPanelItem Text="RadMenustrip" />
                        <telerik:RadPanelItem Text="RadTabStrip" />
                        <telerik:RadPanelItem Text="RadToolStrip" />
                    </Items>
                </telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Other projects">
                    <Items>
                        <telerik:RadPanelItem Text="SiteFinity" />
                        <telerik:RadPanelItem Text="Reporting" />
                        <telerik:RadPanelItem Text="RadAjax" />
                    </Items>
                </telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelBar>
    </div>



    <telerik:RadAjaxManager ID="radajaxmanager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="configurationpanel1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="configurationpanel1" LoadingPanelID="radajaxloadingpanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadPanelBar1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    <telerik:RadAjaxLoadingPanel runat="server" ID="radajaxloadingpanel1" />

    <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1">
        <Views>
            <qsf:View>
                <qsf:ConfiguratorColumn ID="ConfiguratorColumn1" runat="server" Size="Wide">

                    <ul class="fb-group">
                        <li>
                            <qsf:DropDownList runat="server" ID="DropDownListCommandKey"
                                AutoPostBack="true"
                                Width="160px"
                                Label="Command key" />
                        </li>
                        <li>
                            <qsf:MaskedTextBox runat="server" ID="RadMaskedTextBoxFocusKey"
                                ValidationGroup="FocusKeyValidator"
                                CausesValidation="true"
                                AutoPostBack="true"
                                Width="160px"
                                LabelWidth="80"
                                Mask="L"
                                Text="M"
                                SelectionOnFocus="SelectAll"
                                Label="Focus key" />
                        </li>
                        <li>
                            <asp:CustomValidator ID="CustomValidator2" runat="server"
                                Display="Dynamic"
                                ValidationGroup="FocusKeyValidator"
                                ForeColor="Red"
                                Text="* Please type a valid uppercase Latin letter"
                                ClientValidationFunction="validateFocusKey" />
                        </li>
                    </ul>
                </qsf:ConfiguratorColumn>
            </qsf:View>
        </Views>
    </qsf:ConfiguratorPanel>
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script>
            function validateFocusKey(source, arguments) {
                var maskedTextBox = $find("<%= RadMaskedTextBoxFocusKey.ClientID %>");
                var textBoxValue = maskedTextBox.get_textBoxValue().trim();

                if (textBoxValue.length != 1) {
                    arguments.IsValid = false;
                    return;
                }

                var keyCode = textBoxValue.charCodeAt(0);

                if (keyCode < 65 || keyCode > 90) {
                    arguments.IsValid = false;
                    return;
                }
                arguments.IsValid = true;
            }
        </script>
    </telerik:RadScriptBlock>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance