-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Cursor jumps to beginning of line on mobile browsers when focus is lost #5500
Comments
I found a workaround. If you change the inputStyle to "textarea" it works (even without the workaround code above)! By the way I could not find any information on inputStyle and the differences between textarea and contenteditable besides:
|
That'll break touch selection, though |
Found the solution here: [contenteditable="true"] {
-webkit-user-select: text;
user-select: text;
} |
@martinschilliger what element are you applying that CSS to? Along with the cursor position jumping to the beginning, I am also having an issue where |
Just: [contenteditable="true"] {
user-select: text;
}
|
I have a button and a codemirror edit field where a user can type in a SQL query. When they press the button, they query gets send to the server to run and the recordset will be displayed. After clicking on the button, I refocus to the editorwindow so the user can change the SQL query immediately.
On non-mobile browsers this works perfectly, the cursor is put back on the last known position automatically with just this code:
But on mobile browsers the cursor is always set to the beginning of the line of the last known position. I tested in latest FF, Chrome and Safari on iOS v11.4.1 with latest codemirror lib.
I tried to make a work around with this code, but same problem:
Also saving the cursor pos on the Blur event doesn't work.
The text was updated successfully, but these errors were encountered: