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

Caret disappears when dash character inserted on very long text in text box #63

Open
davidlloyduk opened this issue Oct 9, 2022 · 0 comments

Comments

@davidlloyduk
Copy link

davidlloyduk commented Oct 9, 2022

Using the test.html sample provided in the docs (https://rawgit.com/component/textarea-caret-position/master/test/index.html
), in the manual testing ground on top of page enter the following:

MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM-M

image

Notice the red display for the caret disappears when you add 'M' after a '-' characted. Remove the 'M' at the end and displays OK again. Only seems to happen when you cause it to scroll with quite a few letters in the text box. Doesnt appear to happen if you have a few characters.

Only found this as it looks to be causing this issue on Github Desktop: desktop/desktop#6806. I've debugged it there and it seems to return an invalid left value for the caret once the dash is added after calling getCaretCoordinates

Found using Chrome 105.0.5195.127

EDIT: Debugged the code from testarea-caret-position and it seems span.offsetLeft/offsetTop is invalid once a dash is added with a new character

image

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

1 participant