TextField: Does Not Accept Input On Sharepoint Page - IE11 (works elsewhere)
Bug Report
- Package version(s): .88
- Browser and OS versions: ie11 windows 10
Describe the issue:
Text Field rendered in SharePoint (not spFx - but may also affect spfx), does not accept text. Text Field works fine when rendered outside of SharePoint.
To recreate - enter simple react textfield with label and no other elements.
Actual behavior:
TextField does not accept text. This occurs regardless of onchange, onchanged events or whether controlled or uncontrolled input field.
Expected behavior:
Should accept key presses.
@jchilde probably need more information. What page are you rendering the textfield in? Is there some sort of conflicting CSS? Something overlaying the textfield, or maybe soaking click events? Is it a classic sharepoint page or modern?
@srideshpande or @antonlabunets Have you seen this at all?
We've seen it intermittently on File Picker > "From Link" tab. I think @cmalonzo at some point tracked it down to Skype Full Experience soaking?
I am using Sharepoint Online, Typescript 2.1.5. This is not in a spFx webpart. I am also using: "@types/react": "0.14.57", "@types/react-dom": "0.14.20", "office-ui-fabric-react": "^0.87.0", "react": "^15.4.2", "react-dom": "^15.4.2"
The behavior occurs on both a classic sharepoint online wiki page and a classic sharepoint online new item form. There are no other customizations on either page or in the masterpage/custom actions.
For the wiki page, I use a script editor to load React/React Dom as external modules and then the compiled js bundle which replaces a div element.
In the new item form, I use jslink to override the field and then require to load the js bundle and react/react dom, then replace the overridden field element.
In both cases, I have no other page customizations. Thus, the OOB sharepoint online css and scripts are all that are loaded.
When I gulp serve on my dev box, no problems with IE11. When I load in sharepoint as above, the field will render but IE11 will not enter input. If I use a defaultvalue, when I click in the textfield, the cursor skips to the end of the default entry, but does not allow typing or deleting. I have tried every combination of onclick, defaultvalue, value, etc., that I can think of with no changes.
If I go into dev tools, manually edit to add a value, then I am able to enter text until I F5.
The textfield works fine in Chrome and Edge.
I have not been able to find any conflicts with any css item. I get no errors on the page.
To recreate, create the most basic react app you can think of. Simply import React, React-Dom, and office-ui-fabric-react Textfield. Then ReactDOM.Render(
I suspect that something in the classic sharepoint online is causing a conflict, but I am unable to identify the problem.
As a side note, if I load version .36, which uses typings, then the same process above renders a textfield that works in IE11.
I am having the same or similar issue. The issue went away when I removed Compatibility mode in IE11. This seems to be isolated to IE11.
As a possible band-aid/workaround...In IE11, go to the gear icon -> Compatibility View Settings -> uncheck Display intranet sites in Compatibility View.
@dzearing I believe the issue was introduced in v0.86.1.
A fundamental change we did in TextField in v 86.1 is to use onInput instead of onChange due to keystrokes missing behavior, check #744. Not sure why would a native onInput handler not fire if this is the issue.
IE11 compat view; in this mode perhaps there is a different behavior with onInput. We need to test this; @mdahamiwal can you test this?
@mdahamiwal I somehow missed the onInput change. I will update my components out tomorrow and test further.
I am not able to repro with IE11 compatibility mode enabled. @gabrielruss, can you provide IE11 version that you are using?
@gabrielruss Compatability mode does not seem to change my behavior. I am using IE 11.576.14393.0
@dzearing I am not using any event bindings.
Ok so I guess I found a red herring yesterday when troubleshooting. My apologies. The document mode when in IE developer tools now seems to be what causes the text inputs to break. If I switch the document mode to anything except 11, it breaks the text fields. I think the real issue is that my IE keeps randomly switching itself to be in Document Mode 10 for some reason....
@gabrielruss You may have found the issue. SharePoint is forcing IE11 mode with document mode 10. It is possible that this is the cause. Will let you know once I can get to updating.
@gabrielruss @mdahamiwal I can confirm that TextField works fine if you change the document mode to 11 in IE11 Developer Tools. @ SharePoint sets the X-UI-compatible meta tag by default in classic pages, and Edge in Modern Pages.
So... it appears that some Fabric components OOB will not work within SharePoint Classic pages at this time.
Thoughts? #
I am able to repro this with document mode set to IE 10. It starts working if onChange is wired instead of onInput that we are currently using in TextField. When in IE10 doc mode, the onInput event is missing target.value. I tried to repro it outside fabric but it works perfect without any issue https://jsfiddle.net/manishda/s8q8q849/ even in IE10 doc mode. I am debugging it further.
Did a little more debugging. Here is the problem:
We have an input element: <input value={this.state.value} onInput={this._onInputChange} />
The problem occurs when we use this.state.value to pass the value. Since onInput is a native html handler the event.target gives <input value='' /> and this.state.value is empty initially there is no way to retrieve the newValue for the element.
For IE11 onInput provides event.target.value given by the user instead of this.state.value but for IE10 document mode the behavior changes.
There are a few ways to go from here:
- We can fallback to using
onChangeprovided by React instead of nativeonInput. The downside is that users will again start hitting #744 in IE11. - Check if React.js can do something about
onInputevent. But given its a native handler they may close it as browser issue. - Attach both
onChangeandonInputto the same handler and put a check to avoid duplicatesetStateand onchange validation calls. I tried the changes https://github.com/mdahamiwal/office-ui-fabric-react/commit/b81da4abfdf8503619b25025918be73a81f12c43 and it works fine across browsers without regressing #744 and IE10 documents mode. We can get rid offonInputif React 16 fixes the IE11 keystrokes missing issue.
@dzearing, @joschect, thoughts?
@mdahamiwal I think 3 is the correct course of action.
@mdahamiwal I think you had fixed this right? If so please close, otherwise let me know.
I never fixed. I just worked around it. The issue was that it impacted use within Sharepoint on all classic pages.
I just gave up and used a regular textbox applying Office-ui-fabric styling.
I am not capable to fix the underlying code. Just reporting that a bug exists. It does not appear to be fixed.
From: David Zearing [mailto:[email protected]] Sent: Tuesday, February 21, 2017 6:47 PM To: OfficeDev/office-ui-fabric-react [email protected] Cc: Jeffrey Childers [email protected]; Mention [email protected] Subject: Re: [OfficeDev/office-ui-fabric-react] TextField: Does Not Accept Input On Sharepoint Page - IE11 (works elsewhere) (#824)
@mdahamiwalhttps://github.com/mdahamiwal I think you had fixed this right? If so please close, otherwise let me know.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-ui-fabric-react/issues/824#issuecomment-281520164, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AK1m6dqk0QgNQl-u-r_X4XmQzHSS2OVUks5re3dggaJpZM4LkMgM.
@dzearing, i missed it, Thanks for pointing it out.
Should now be resolved. Please re-open if the issue still persists after tonights published build.