Skip to content

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

Description

@davidlloyduk

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions