vaadin / flow-components

Java counterpart of Vaadin Web Components
99 stars 66 forks source link

GridPro: EnterNextRow not fully supported with Select Editor #5967

Open mpaeschbacher opened 7 months ago

mpaeschbacher commented 7 months ago

Description

I set enterNextRow to true on a Grid Pro. I then add an EditColumn with the built-in select editor. When navigating through the grid with enter, i have to change the value of a select to be able to enter the next row.

Expected outcome

I would expect that I can advance to the next row by pressing enter without having to edit the value of the select.

Minimal reproducible example

GridPro<Node> grid = new GridPro<>();
grid.setEnterNextRow(true);
grid.setItems(List.of(new Node("a"), new Node("b"))).setHeader("Built in select");

grid.addEditColumn(Node::getValue)
    .select(Node::setValue, List.of("a", "b", "c"));

Select<String> simpleSelect = new Select<>();
simpleSelect.setItems(List.of("a", "b", "c"));
grid.addEditColumn(Node::getValue)
    .custom(simpleSelect, Node::getValue, Node::setValue).setHeader("Custom select");

Steps to reproduce

  1. Add class Node with string field
  2. Add the above snippet to a view
  3. Click the first cell, press enter
  4. Notice how the edit mode is not exited and the next cell is not focused
  5. Click the first cell, change the value with the arrow keys, press enter
  6. Notice how the edit mode is exited and the next cell is focused

Note: a custom select editor does not work at all with enterNextRow

Environment

Vaadin version(s): 24.3.1 OS: macOS Ventura 13.5

Browsers

Issue is not browser related

yuriy-fix commented 7 months ago

Possible solution would be to close the overlay on pressing Enter / Space on the selected item in Select component.