Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GridPro: Edit on typing selects the first entered character #6117

Closed
finaris-cs opened this issue Mar 12, 2024 · 1 comment · Fixed by vaadin/web-components#7235
Closed

Comments

@finaris-cs
Copy link

Description

I have a grid pro, with an editable column containing text.
When the user starts entering a text, e.g. 'myText', the following happens:

  1. The target cell is focussed, but not in edit mode
  2. User hits 'm' key, editing starts (ok), and the text field selects all input ('m')
  3. User hits 'y', text in the editor ('m') gets replaced.
  4. User types the rest of his text, resulting in 'yText' insted of 'myText' in the cell.

I am not sure when this was introduced, but I am pretty sure that the behaviour was as my expected outcome in the past.

Expected outcome

Do not select all content when the editor is activated by a key that already changed the input.

Minimal reproducible example

@Route(value = "test")
public class TestView extends VerticalLayout {


    public TestView() {
        setSizeFull();
        GridPro<TestData> grid = new GridPro<>(200);
        grid.setSizeFull();
        grid.getDataCommunicator().setPagingEnabled(false);
        grid.setEnterNextRow(true);
        grid.setMultiSort(true, Grid.MultiSortPriority.APPEND, true);

        grid.addColumn(TestData::getId)
                .setFlexGrow(0)
                .setHeader("ID");

        grid.addEditColumn(TestData::getValue)
                .text(TestData::setValue)
                .setHeader("Value (Editable)");

        grid.setItems(IntStream.range(1, 20)
                .mapToObj(i -> new TestData(i, "Data_" + i))
                .collect(Collectors.toList()));

        add(grid);
    }

    public static class TestData {
        private final int id;
        private String value;

        public TestData(int id, String value) {
            this.id = id;
            this.value = value;
        }

        public int getId() {
            return id;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }
    }

Steps to reproduce

Use the code above and edit a value in the value column as described in my bug description above.

Environment

Vaadin version(s): 24.3.3 and above
OS:

Browsers

Issue is not browser related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants