[TextField] type="number" shows hintText when value has dots and commas
See original GitHub issueProblem Description
When using a TextField with type “number” and showing a hintText, if user types certain combinations of dots, commas and numbers, the hintText is shown. Combinations that showed this behaviour:
123.
123.456,
123.456,78
123.456.
123.456.789
123,456,
123,456,789
123,456.789
import React from "react";
import { TextField } from "material-ui";
export class TextFieldTest extends React.Component {
render() {
let handleChangeValue = () => { console.log("args", arguments); };
return (
<TextField
hintText="Type a number"
fullWidth={true}
type="number"
onChange={handleChangeValue}
/>
);
}
}
Rendered component
Correct behaviour 1 (value: 123)
Correct behaviour 2 (value: 123.456)
Correct behaviour 3 (value: 123,456)
Wrong behaviour 1 (value: 123.)
Wrong behaviour 2 (value: 123.456,)
Wrong behaviour 3 (value: 123.456,78)
Wrong behaviour 4 (value: 123.456.)
Wrong behaviour 5 (value: 123.456.789)
Wrong behaviour 6 (value: 123,456,) even though it doesn’t show the hintText, it is still not a number
Wrong behaviour 7 (value: 123,456,789)
Wrong behaviour 8 (value: 123,456.789)
Versions
- Material-UI: 0.14.1
- React: 0.14.7
- Browser: Chrome 49.0.2623.110 m
I haven´t been able to test with Material-UI HEAD, yet. I’ll post results as soon as I do.
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (3 by maintainers)
Seems to rooted in the detection of non number characters as a pre condition for clearing the hint text.
On Wed, Apr 25, 2018 at 10:14 AM, Ann Layman notifications@github.com wrote:
Latest version still has this issue. The bug is easily reproducible, simply let ‘.’ be the first character entered into the field and you can see the problem. My guess is the field needs to clear hint text when ANY content is entered