My users are having an intermittent issue that I can't reproduce

We use CodeMirror with markdown as our primary editor. Last month, I upgraded CodeMirror and opened a discussion up for bug reports, and a handful of my users all reported an intermittent problem with the cursor (which apparently has been going on since before the upgrade, but they neglected to tell me, because users are like that).

They are all experiencing it, but I can’t reproduce it for anything!

Here is their description of the problem:

I tried to diagnose the problem with one user in particular who experiences the problem consistently (while everyone else seems to be intermittent) to no avail:

https://www.daniweb.com/members/787121/mike200017/chat/2015/01/03
https://www.daniweb.com/members/787121/mike200017/chat/2015/01/03/2

He is experiencing the problem, as well, at https://www.daniweb.com/dev/codemirror which is a dummy page I created that has nothing except for our environment and the editor. It does not load the Markdown parser or our keymap, and he still has the problem.

I’m out of ideas because I can’t reproduce this. Help greatly appreciated :frowning:

I realize I framed my question incredibly poorly.

Here’s the problem:

  1. When text spans multiple lines (word wrap), when they position the cursor at the end of the text, and repeatedly press the left arrow key, instead of moving from the beginning of the line to the end of the previous line, it moves from the beginning of the line to the beginning of the previous line. However, when they type, the text inputs at the correct space.
  2. If the line ends with a space, if they try to move the cursor to the place just before the space (after the last non-space character), it just jumps to the start of that line instead.

I am not able to reproduce the problem. However, it is now happening consistently for them. It seems to be a Chrome / Chromium-only bug.

They are not able to reproduce the problem within CodeMirror’s demos, so it seems specific to my environment.

I created a dummy page at https://www.daniweb.com/dev/codemirror that has nothing except for our environment and our editor. It does not load the Markdown parser or our keymap, and users are still experiencing the problem there. Therefore, my guess is that it is a CSS conflict (most likely related to auto-sizing?)

I could reproduce this in Chrome in your dummy page, but not in any demo on the codemirror website. As such, yes, a CSS conflict sounds likely. Try finding the problem by repeatedly removing pieces of your own custom styling, and seeing which one triggers this issue.

My problem is that, unfortunately, I can’t reproduce the problem no matter what I do.

This is my only CodeMirror-related CSS:

div.CodeMirror
{
	border: 1px solid #D2D2D2;
	margin-bottom: 10px;
	background-color: white;
	height: auto;
	font-family: Consolas, Monaco, Courier New, Courier, monospace !important;
	line-height: 1.2em;	
}

div.CodeMirror-scroll
{
	min-height: 100px;
}

div.editor-container .cm-s-default span { color: inherit; }
div.editor-container .cm-s-default span.cm-comment { color: green; }
div.editor-container .cm-s-default span.cm-header { color: #752F8E; }
div.editor-container .cm-s-default span.cm-quote { color: #777; }
div.editor-container .cm-s-default span.cm-link { color: #03C; }

I’ve basically just been using the Chrome element inspector to inspect every CM-related node, one at a time, and see if the nodes on DaniWeb have any additional styling vs the nodes on CodeMirror. So far I haven’t come across anything.

So far I have two confirmations from people who say it happens consistently who are both using Linux and Chrome. Are you, also, by any chance using Linux? I cannot reproduce on the latest version of Chrome for OS X or for Windows 8.

Oh wow!!! I was just able to reproduce this on my work computer!!! Now I can actually properly diagnose the darn thing. Windows 8 and Chrome.

So the problem was relatively easy to figure out (by systematically turning off CSS) once I was able to reproduce the problem myself.

It looks like the cause of the problem was:

body { text-rendering: optimizeLegibility; }

I was only able to reproduce the problem myself in one instance of Chrome / Windows 8. Marijn, this might be something you want to look into.

I’ve pushed patch 6534d9e1aa49 to address this.