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

Position is wrong, if text ist longer than inputbox/textarea #51

Open
anotherCoward opened this issue Dec 9, 2018 · 2 comments
Open

Comments

@anotherCoward
Copy link

if (element.scrollLeft)
  coordinates.left = coordinates.left - element.scrollLeft;
if (element.scrollHeight)
  coordinates.top = coordinates.top - element.scrollTop; 

right before returning the result, solves the issue.

@schinizel
Copy link

This does not resolve the issue completely. In cases for inputs specifically, hyphenated words cause the mirrored div to wrap incorrectly (even if you are using break-word and the like). Notice the effect when you type hyphenated strings on the demo fiddle.
image

Since the package is forcing white-space: pre-wrap on the input as well as textarea there is no easy way around this.

ckruse added a commit to ckruse/cforum_ex that referenced this issue Jun 24, 2019
This happens due to a bug in textarea-caret-position:
component/textarea-caret-position#51

fixes #37
@Tolgor
Copy link

Tolgor commented Jun 3, 2020

Same issue here on an <input>.
Ugly fix:

/* textarea-caret fix */
:global #input-textarea-caret-position-mirror-div {
  visibility: hidden !important;
  top: 0 !important;
  white-space: nowrap !important;
}

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

3 participants