Ticket T1265190
Visible to All Users

DxGrid for Blazor - Customize Keyboard Navigation: Enter Key

created 4 months ago

Dear DevExpress Team,

I have a question regarding the new keyboard navigation for DxGrids in recent updates.
I'm working on this project for a while and implemented custom keyboard navigation in my grids for editing data and writing them back to a SQL database.

Unfortunately the newly introduced default keyboard navigation interferes with my own one.
I used the Escape key for canceling the edit mode and the tab key for jumping from one cell to another. So far so good.

But the new keyboard behaviour unfortunatly breakes my intended use for the Enter key. I implemented this as a key that saves the edited data to the database without the need of a seperate button.
Now the enter key just exits out of the edit component and my custom keyboard handler doesn't recognize the enter key anymore.

Is there a way to customize these keyboard events, so that a can use the enter key to fire my custom event again?

Thanks a lot in advance!

Greetings,
Christian Köhler

Comments (3)
KV KV
Keanu Villanueva (DevExpress Support) 4 months ago

    Hello Christian,

    You are correct - the built-in keyboard support introduced in v24.1 can break your custom keyboard navigation logic as described in the following Breaking Change: Grid – Keyboard navigation is now enabled by default.

    The Enter key is reserved for Keyboard Navigation (see Keyboard Shortcuts). Unfortunately, DxGrid does not have the built-in API to customize keyboard shortcuts. Therefore, we can only recommend the following solutions:

    1. Modify the logic in your application as required (e.g., use a different shortcut).
    2. Use the workaround described in the Breaking Change.

    Let us know if you need further clarification.

    Regards,
    Keanu

    CK CK
    Christian Köhler 4 months ago

      Thank you for your quick response.

      So, as far as i can understand, there is no way to add extra functionality to the Enter key event, like input validation and/or automatic saving to my database, or do i miss any possibilities?
      Using any key other than Enter like would be very confusing to my user base, unfortunately.

      If thats the case, it's a real bummer for my use case.
      I hope such a functionality will be added in the future.

      Regards,
      Christian

        Hi,

        Sorry for going into this thread, but I am 100% on Christian's side here.
        To prevent a user from letting the return key "do stuff" seems very strange to me.
        Please consider changing this since it is simply against logic widely used in UI design.

        Regards Torben

        Answers approved by DevExpress Support

        created 4 months ago

        Thank you for the feedback, Christian. We have no plans for an API that allows you to override the "Enter" key usage. However, I forwarded your inquiry to our R&D team. We will notify you if our plans change.

        If you don't use the EditCell mode, you can use the following property to disable the built-in keyboard navigation: CompatibilitySettings.DisableKeyboardNavigationInGrid. If you want to use the EditCell mode, the built-in keyboard navigation is required.

        Alternatively, you can handle the keydown event of the window object on the client manually. I illustrated the idea in the sample project that is attached below. The project shows how you can implement custom shortcuts for the Grid or just cancel the ones we have. In the sample, I show how you can display a popup for the focused row on Shift+Enter and let the Grid process Enter without modifiers as usual. Navigate to the "weather" tab to test the solution.

        Regards,
        Alex

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.