Unplanned
Last Updated: 21 Oct 2020 07:06 by ADMIN
Linus
Created on: 21 Oct 2020 06:42
Category: ToolBar
Type: Bug Report
2
RadToolBarButton does not trigger Clicked Event on Enter-key

The issue can be reproduced in Chrome, Edge, FireFox.

Steps to replicate: In the browser, navigate to the RadToolBarButton and press enter. (click is not performed and events are not fired)

<script>    
    function buttonClicked(sender, args) {
        debugger;
    }
    function buttonClicking(sender, args) {
        debugger;
    }
</script>
<telerik:RadToolBar ID="RadToolBar1" runat="server" OnClientButtonClicked="buttonClicked" OnClientButtonClicking="buttonClicking">
    <Items>
        <telerik:RadToolBarButton Text="Button"></telerik:RadToolBarButton>
    </Items>
</telerik:RadToolBar>

1 comment
ADMIN
Doncho
Posted on: 21 Oct 2020 07:06

A workaround approach is to wire the 'keydown' event to all the RadToolBar Items and trigger a click on the currently targeted element when Enter is pressed:

$('document').ready(function () {
    var items = $('.RadToolBar .rtbItem');
    items.on("keydown", clickOnEnter);
});
function clickOnEnter() {
    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;

    if (keyCode == 13) {
        $(event.currentTarget).trigger("click");
    }
}

Kind regards,
Doncho
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.