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

[TextField] On IE, the browser-specific X to clear the text field's contents does not trigger onChange events. #4928

Closed
lawrence-yu opened this issue Aug 8, 2016 · 7 comments
Labels
component: text field This is the name of the generic UI component, not the React module! external dependency Blocked by external dependency, we can’t do anything about it

Comments

@lawrence-yu
Copy link

Problem description

On Internet Explorer, a black X shown on the right end of a TextField component if there is some text present. Clicking on this X is supposed to clear the contents of the text field.

On a controlled TextField component, clicking on this X does not fire an onChange event. The text will disappear after clicking it, but clicking elsewhere causes the old value to reappear.

For uncontrolled TextField components, the component behaves normally.

Steps to reproduce

  1. Using Internet Explorer
  2. Go to http://www.material-ui.com/#/components/text-field
  3. Go to the Controlled Example.
  4. Type some text in the TextField.
  5. With the focus in the TextField, a black X should be available. Click on it.
  6. Observe that the text disappears.
  7. Click outside of the TextField.
  8. Observe that the previous text reappears.

Versions

  • Material-UI: ^15.0.0
  • React: ^15.0.0
  • Browser: Internet Explorer
@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 14, 2016

Are you also able to reproduce this issue with a raw <input />?

@lawrence-yu
Copy link
Author

lawrence-yu commented Aug 15, 2016

Initially, no. Using the same code as the Controlled Example but with a raw <input />, I was not able to reproduce the behavior. http://codepen.io/lawrenceyu/pen/dXaLoZ

However, I noticed that the component was not being re-rendered when clicking the X and then clicking outside of the <input />

I then added isFocused to the state, as well as onFocus and onBlur handlers onto the <input /> (mimicking part of the TextField implementation), and this component reproduced the original behavior. The controlled value does not change when the X is clicked (because the onChange event is not fired), and now the component re-renders because of the change of the isFocused state, rendering the old value. http://codepen.io/lawrenceyu/pen/xOrZdY

@oliviertassinari
Copy link
Member

Sounds like an issue with React itself: facebook/react#6822.

@oliviertassinari oliviertassinari added the external dependency Blocked by external dependency, we can’t do anything about it label Aug 15, 2016
@oliviertassinari oliviertassinari added the component: text field This is the name of the generic UI component, not the React module! label Oct 19, 2016
@codylawson
Copy link

Would it be worthwhile to hide the clear button on inputs altogether until this is resolved? Something similar to:

input[type="text"]::-ms-clear {
  display: none;
}

There's also an issue where the clear button takes up the full height of the input, this is a problem on inputs with a floating text label.
screen shot 2017-06-02 at 9 05 58 am
Would we want to adjust the height to 1em to make it more consistent across inputs?

@oliviertassinari
Copy link
Member

@codeheroics Have a look at #5055.

@codylawson
Copy link

Ack, should have been more thorough in my search. Thanks @oliviertassinari

@oliviertassinari
Copy link
Member

The issue was fixed by React facebook/react#8575. We can close :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module! external dependency Blocked by external dependency, we can’t do anything about it
Projects
None yet
Development

No branches or pull requests

3 participants