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

Chrome/Android - when editor has an horizontal scrollbar it scrolls to the right even when the caret is within the viewport #752

Open
ggrossetie opened this issue Feb 25, 2022 · 5 comments

Comments

@ggrossetie
Copy link

Sorry for the long title but it's hard to explain!
Here's a short screencast to showcase this issue:

scroll

As you can see, when I click on an empty line (line 4), it scrolls to the right.
As a result the cursor is underneath the gutter (line numbers).

And when I click on the first line just after the word "long", it also scrolls to the right even though the caret was within the viewport.

I'm using Chrome 98.0.4758.101 on Android 12. The video was recorded using remote debug and the text editor on the https://codemirror.net/6/ page.

It seems that Chrome somehow ignores the gutter and tries to align the text to the left edge.

@marijnh
Copy link
Member

marijnh commented Feb 25, 2022

The weird thing is that, though it looks like the editor is scrolling horizontally, its scrollLeft does not change. So most likely this is triggering some kind of horrible kludge in Chrome, intended for who-knows-what situation, and it may take a bit of research to figure out how to work around it.

@ggrossetie
Copy link
Author

Yes... this is also specific to Chrome/Android. It seems that the browser tries to center/align the content editable element, maybe to prevent some dark patterns where you would type on a non-visible element?
Anyway, I didn't find any hint while doing some research online so I can only guess 😞

@a1ooha
Copy link

a1ooha commented May 20, 2022

Same problem, any updates? @marijnh

@bushev
Copy link

bushev commented May 21, 2022

Guys, I have the same issue on Android 11.

@marijnh
Copy link
Member

marijnh commented May 27, 2022

I think at this point our best bet is to try and reduce this to the minimal DOM structure that triggers it, and report it as a Chrome bug, since the chances of being able to work around it in the library aren't looking good. Anyone want to work on that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants