react-textarea-autosize icon indicating copy to clipboard operation
react-textarea-autosize copied to clipboard

Update to support horizontal overflow

Open chrisdrackett opened this issue 10 years ago • 11 comments

This is useful for textarea elements that contain code, but with line lengths greater than the textarea's width

chrisdrackett avatar Feb 03 '16 22:02 chrisdrackett

hey @chrisdrackett , is original behaviour preserved after ur change? Did u test it doesnt break any other assumptions? Would like to incorporate your fix, but with such changes we need to be cautious. Do u use ur fork in ur projects and everything is working like expected?

Andarist avatar Apr 29 '17 17:04 Andarist

@Andarist I missed your note somehow, sorry about that. We are using this fork in our project without any issues. I did test this with our use of the package, but I'm not sure if I'm running the same tests that others are!

chrisdrackett avatar Jul 05 '18 16:07 chrisdrackett

@chrisdrackett Could u showcase ur use case on smth like codesandbox.io? I could then experiment with ur use case and some other ones - unfortunately this package has no tests 😭 so I'm really cautious about introducing changes, especially related to those particular properties lists as they seem fragile.

Andarist avatar Jul 05 '18 16:07 Andarist

I'm a few years behind, but I came up with a similar problem.

demo: simply copy & paste the url to the demo page.

I see that the code has changed a bit since, so we can't just merge the PR right away.

I'm curious whether solving this issue is still of interest?

OBS. It's 100% coincidence that the original author and I have a similar avatar

jangxyz avatar Mar 12 '21 04:03 jangxyz

From the given screenshot im not sure what the problem is. Could u describe it?

Andarist avatar Mar 12 '21 07:03 Andarist

I'd expect the textarea to resize in accordance with word wrapping as well, so having a single long line of text wouldn't create any vertical scroll bars.

jangxyz avatar Mar 12 '21 07:03 jangxyz

Well, you don't have a horizontal overflow there - you get a vertical scrollbar. And this is expected as this particular textarea has maxRows set to 3: https://github.com/Andarist/react-textarea-autosize/blob/58c9807645dceb9034b733d9cb63aa66df2364b0/example/index.tsx#L11

Andarist avatar Mar 12 '21 09:03 Andarist

You're right. Sorry I didn't check the source for other props.

For some reason I do keep encountering vertical sidebars, especially when I work with long urls. That's how I reached here in the first place. Not sure what the exact reason is though (yet). I'll try to come up with a more evident example next time.

jangxyz avatar Mar 12 '21 10:03 jangxyz

I don't have an example at this time as I ended up just moving to react-expanding-textarea some time ago. I know it was partially due to this issue that I moved, but its been so long as this point that I don't remember any of the details. I think this PR is still valid, as I do remember it fixed some of the style issues we were having with this library, but as I no longer have skin in the game I understand and have no issues if it needs to be closed!

chrisdrackett avatar Mar 16 '21 16:03 chrisdrackett

Any chance for this PR to still be merged?

I'm using this lib for a custom code input and the calculated height is incorrect when I set white-space: pre;.

piotrkulpinski avatar Feb 01 '24 11:02 piotrkulpinski

Actually, I don't think this will work as the PR adds white-space: pre; to every field, instead of checking the original textarea style.

piotrkulpinski avatar Feb 01 '24 11:02 piotrkulpinski