Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Multi-editor back button bug (Firefox) #932

Open
nwinant opened this Issue Nov 7, 2012 · 9 comments

Comments

Projects
None yet
5 participants

nwinant commented Nov 7, 2012

If two CM editors are in the same form, only the first editor will preserve its contents after the user has submitted the form and pressed the back button.

Test case: http://jsbin.com/azurod/1/edit

This occurs in Firefox 11, 12 & 16 on 64-bit Debian 6.0. This does not occur in in Firefox 16 on OS X, or Chrome 23 on 64-bit Debian 6.0.

Contributor

peterkroon commented Nov 8, 2012

I have no linux, and was unable to reproduce...
Could it be a browser issue only?
I've set up a demo with only 2 textarea's and the submit button.
http://jsbin.com/azurod/3/edit

nwinant commented Nov 8, 2012

Textareas behave fine (I actually tested that before submitting the bug, which I should've mentioned in my original report. Sorry about that.) The problem really does seem to lie with CodeMirror on FF on Linux. I'll see if I can reproduce it on Windows, but the fact that I can't reproduce it on OS X leads me to suspect that it only occurs on Linux.

Contributor

peterkroon commented Nov 8, 2012

I can reproduce on Firefox stable.
W732

nwinant commented Nov 8, 2012

Excellent! And I've just verified that this bug can be reproduced on FF 15 on Win XP (we're not exactly a big windows shop...)

Contributor

peterkroon commented Nov 8, 2012

Unable to reproduce on Chrome stable W732

Contributor

peterkroon commented Nov 8, 2012

Unable to reproduce on Opera stable W732

Owner

marijnh commented Nov 9, 2012

Reproduced. Unfortunately, the input-restoring functionality in browsers is underspecified and unpredictable. It seems the presence of CodeMirror is throwing off Firefox's algorithm in this case. I did some experiments with removing CM's internal textarea on submit and un-hiding the form's textarea, but that did not appear to help.

I think the only way to get this to work would be to spelunk through the Firefox sources and try to figure out where it goes wrong, and then use that information to either add a workaround to CodeMirror (such a pull request would be welcome) or patch Firefox itself.

@marijnh Tested using Firefox 17.0.1 and CodeMirror 3.0 on Windows 7 -- can't reproduce. Firefox seems to restore the values appropriately.

kidwm commented Apr 20, 2013

I've made some test cases and tried to triage this issue.

This test page consists of three textarea.

http://file.kidwm.net/sandbox/problem/
After page loaded, just hit Ctrl + R, The contents of second an third textarea would disappear.
Then add some texts in the first and second textarea, hit Ctrl + R again, you would see the new contents go into the second and third textarea.

http://file.kidwm.net/sandbox/nofirst/
remove CodeMirror from the first textarea, now works good.

http://file.kidwm.net/sandbox/noauto/
add <autocomplete=""off"> to the form element, disabling the autocomplete feature is just a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment