Vaadin Grid-Pro handling of ESC while editing cell

55 views Asked by At

i am using the vaadin grid-pro web-component in conjunction with flow to let the user edit data in a grid. I noticed that using the ESC key via keyboard let s the user exit the edit mode, in case a cell is edited. So far so good. But how does the ESC key event gets consumed?

I had a look at https://github.com/vaadin/web-components/blob/v24.2.0/packages/grid-pro/src/vaadin-grid-pro-inline-editing-mixin.js#L88 where the ESC key gets handled, stopping the edit state. But there is no stopPropagation() of that event.

Having additionally a vaadin-button with an attached ESC shortcut fires indeed. How can i prevent the button shortcut from firing? (hoping that also the keydown event is used; else things get even more complicated)

Any hint appreciated, Dan

1

There are 1 answers

1
Tatu Lund On

If you add shortcut listener to GridPro that stops the propagation, it should work. At least in simple case I had it seems to solve the issue.

    Shortcuts.addShortcutListener(grid, e -> {}, Key.ESCAPE).listenOn(grid).setEventPropagationAllowed(false);