KevinVandy/material-react-table

Text Field: Characters Duplicated on Enter When Confirming Composition

akadateppei opened this issue · 1 comments

material-react-table version

v2.13.1

react & react-dom versions

v18.2.0

Describe the bug and the steps to reproduce it

Here are the steps to reproduce the issue:

Create an editable table that includes a text field.
Edit the text field with any Japanese text.
Confirm the composition.
The text is entered twice.

Minimal, Reproducible Example - (Optional, but Recommended)

This is an example excerpted from a storyboard.

export const CreateRowIndexTop = () => {
  const [tableData, setTableData] = useState(data);

  const handleSaveRow: MRT_TableOptions<Person>['onEditingRowSave'] = ({
    exitEditingMode,
    row,
    values,
  }) => {
    tableData[row.index] = values;
    setTableData([...tableData]);
    exitEditingMode();
  };

  return (
    <MaterialReactTable
      columns={[
        {
          accessorKey: 'firstName',
          header: 'First Name',
        },
        {
          accessorKey: 'lastName',
          header: 'Last Name',
        },
        {
          accessorKey: 'address',
          header: 'Address',
        },
        {
          accessorKey: 'state',
          header: 'State',
        },
        {
          accessorKey: 'phoneNumber',
          enableEditing: false,
          header: 'Phone Number',
        },
      ]}
      createDisplayMode="row"
      data={tableData}
      editDisplayMode="row"
      enableEditing
      onCreatingRowSave={() => {}}
      onEditingRowSave={handleSaveRow}
      positionCreatingRow="top"
      renderTopToolbarCustomActions={({ table }) => (
        <Button onClick={() => table.setCreatingRow(true)}>Add</Button>
      )}
    />
  );
};

Screenshots or Videos (Optional)

2024-08-23.23.21.06.mov

Do you intend to try to help solve this bug with your own PR?

Yes, I am also opening a PR that solves the problem along side this issue

Terms

  • I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Should be fixed in v2.13.2