Duplicated
Last Updated: 02 Sep 2021 05:40 by ADMIN
tilt32
Created on: 25 Jan 2021 09:24
Category: Window
Type: Feature Request
5
Ability to customize and disable the keyboard shortcuts of TelerikWindow

I am running into an issue with what I believe is the default behaviour of the TelerikWindow, namely capturing @onkeydown - events and closing the window when the user presses escape.

Is there any way to disable this default behaviour of the dialog / overwrite its onkeydown event handler?

---
ADMIN EDIT

Include the ability to :

  • Disable keyboard shortcuts altogether
  • Use custom keyboard shortcuts
  • Use a combination of several keys (e.g. Shift + ESC)
  • Define several keyboard shortcuts at the same time for the same action

If you have any preferences how to expose this functionality please leave a comment. Any feedback on how to handle this on a Mac for the Ctrl and CMD keys is welcome (e.g. should the shortcut for the Ctrl key handle the CMD key for the Mac automatically).

In the meantime you could use the following snippet as a workaround to disable the Esc key:

@result

<TelerikButton OnClick="@ToggleWindow">Toggle the Window</TelerikButton>

<TelerikWindow Visible="@isVisible" VisibleChanged="@VisibleChangedHandler">
    <WindowTitle>
        <strong>The Title</strong>
    </WindowTitle>
    <WindowContent>
        This is my window <strong>popup</strong> content.
    </WindowContent>
    <WindowActions>
        <WindowAction Name="MyCustomClose" Icon="@IconName.Close" OnClick="@MyCustomCloseHandler" />
    </WindowActions>
</TelerikWindow>

@code {
    bool isVisible { get; set; }
    string result { get; set; }

    void VisibleChangedHandler(bool currVisible)
    {
        // if you don't do this, the window won't close because of the user action
        // so if you don't update the view-model here, the window will not close when Esc is pressed

        //isVisible = currVisible;

        result = $"the window is now visible: {isVisible}";

        Console.WriteLine($"Closing because of Esc key");
    }

    void MyCustomCloseHandler()
    {
        //will fire on click only
        isVisible = false;
        //since the built-in window UI didn't invoke this change, the event will not fire
    }

    public void ToggleWindow()
    {
        isVisible = !isVisible;

        result = $"the window is now visible: {isVisible}";
    }
}

---

Duplicated
This item is a duplicate of an already existing item. You can find the original item here:
1 comment
ADMIN
Svetoslav Dimitrov
Posted on: 02 Sep 2021 05:40

Hello Karl,

We have a new feature request regarding the Ability to customize the keyboard shortcuts in all applicable Telerik UI for Blazor components. I have added your Vote for it and you can click the Follow button to receive email notifications on status updates.

I have also transferred all votes from this feature request to the more general one.

That being said, I am marking this thread as a duplicate.

Regards,
Svetoslav Dimitrov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.