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

Don't set empty placeholder to work around IE11 bug #11177

Merged
merged 2 commits into from
Oct 10, 2017

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Oct 10, 2017

Should probably fix #11172.
Based on 15 branch code:

// Avoid setting textContent when the text is empty. In IE11 setting
// textContent on a text area will cause the placeholder to not
// show within the textarea until it has been focused and blurred again.
// https://github.com/facebook/react/issues/6731#issuecomment-254874553
if (contentToUse !== '') {
if (__DEV__) {
setAndValidateContentChildDev.call(this, contentToUse);
}
DOMLazyTree.queueText(lazyTree, contentToUse);
}

I made the fix more targeted to make it clearer.

I haven't tested because I don't have IE.

@aweary
Copy link
Contributor

aweary commented Oct 10, 2017

@gaearon I added a test case for textarea placeholders and deployed the DOM fixtures with this build here: http://placeholder-fix-ie11.surge.sh/textareas

It looks like the placeholder is now correctly rendered in IE11 on Windows 10.

@gaearon gaearon merged commit 309fa6c into facebook:master Oct 10, 2017
@gaearon gaearon deleted the fix-ie11-placeholder branch October 10, 2017 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

React 16 does not render text area placeholder initially in IE11 Win10
3 participants