Material-ui: [TextField] Cursor jumps to the beginning of the field when deleting spaces in an email <TextField>

Created on 14 Feb 2019  路  2Comments  路  Source: mui-org/material-ui

  • [x] This is not a v0.x issue.
  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

In an email TextField if you delete a character placed before of a white space, the cursor should stay in the same position.

Current Behavior

In an email TextField if you delete a character that is placed before a white space, the cursor jumps to the beginning of the field.

Steps to Reproduce

You can see this issue in the demo TextField page https://material-ui.com/demos/text-fields/
bugtextfieldmui

| Tech | Version |
|--------------|---------|
| Material-UI | v3.9.2 |
| Browser | Chrome 71 (In Firefox seems that its working as expected) |

bug 馃悰 TextField external dependency

Most helpful comment

Ok, I think that you can track: https://github.com/facebook/react/issues/14168.

All 2 comments

@DaniSomoza Thank, it's a regression of React. https://codesandbox.io/s/xrv5w1j90w. It was introduced between React v16.2.0 and v16.3.0. I'm opening an issue on their side.
The reproduction is as simple as:

import React from "react";

function Yolo() {
  const [value, onChange] = React.useState("");
  return (
    <input
      type="email"
      value={value}
      onChange={event => onChange(event.target.value)}
    />
  );
}

export default Yolo;

Ok, I think that you can track: https://github.com/facebook/react/issues/14168.

Was this page helpful?
0 / 5 - 0 ratings