-
Notifications
You must be signed in to change notification settings - Fork 73
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
Sometimes scrollbars show up on textarea #8
Comments
For a differential diagnosis between a textarea with scrollbars and one without see: I don't know what's going on here that's keeping this from working, but I've set up the jsFiddle so that someone can perhaps tinker with it. |
It has just occurred to me that the solution may be as simple as This solves the problem for the http://jsfiddle.net/cBcTq/3/ example. Before this is marked closed I'd like to do some more testing because I've happened on some cases where it doesn't solve the problem (i.e. there are no scrollbars, but not all the text is contained in the textarea). I'll try and set up another example. |
Oh yeah, thanks for the comparison demo. For some reason in my environment I had to bump the #hasbars from 350px to 360px. The overflow hidden definitely seems to fix the problem, but I would prefer to not have to resort if possible since that could cause an issue if a bug happened and you couldn't see anything in the textarea, versus now where it is more of a cosmetic problem with the scrollbars. |
Still haven't quite figured out what is happening, but with a fork of the previous fiddle, I am showing the difference between the two (with the The scrollbars throw everything off, so the issue is why they show up in the first place. Still looking into it. |
Me either. I emailed Neil Jenkins (sorry, I should have copied you - I'll Oh - I completely agree about the There may be two problems that are conflated:
To diagnose problem #2, we may have to add I'll try and reproduce problem #2 and post it to your Fiddle so we can see what's happening. |
It's definitely funny - it is like the scrollbars showing up cause the measurements to be all wrong because of the extra 16px on the right that the pre has. However, the scrollbars shouldn't be showing up unless if the measurements are wrong in the first place. |
Okay, the issues I was having elsewhere were with incorrect textarea width by some bad css elsewhere interfering. A good test would be to check that the I cannot reproduce the problem when The That being said, |
Yeah, that is about as far as I was able to get on the problem too. I started a branch https://github.com/bgrins/ExpandingTextareas/tree/cleaner-css to try playing with different ways of storing the markup and CSS to see if it helped, but the same problem seemed to creep up. I might try to incorporate some of those changes into master anyway, but they definitely didn't fix this issue like the I still don't really like the overflow hidden trick, but it is worth noting that this is used in the original article: http://www.alistapart.com/articles/expanding-text-areas-made-elegant/ |
Neil Jenkins got back to me and confirmed that the Here's what Neil wrote:
That being the case, adding |
Thanks for following up on this. That should be enough to fix the issue in question, yes. The only thing I could see this messing up is the "max-height" example here: http://bgrins.github.com/ExpandingTextareas/. |
I suppose it could be an option to allow scrolling if you want the ability to set a max height |
Good point - this would break Your suggestion to add an option permitting scrollbars is probably better - let the user decide. Alternatively, you could make |
I was also just playing with this, and I found a fix (at least for the example you gave and in Chrome). By adding an extra line break at the bottom, it seems to not cause the race condition situation you refer from Neil. See this branch here (which has some other changes as well): https://github.com/bgrins/ExpandingTextareas/blob/cleaner-css/expanding.js. Not sure if it is a real solution (plus it adds an extra line to the bottom of the textarea that can't be removed). |
This actually seems to work now with no fix in the latest version Chrome. Maybe they fixed the race condition issue? Still an issue in Firefox though. |
I’m still experiencing this issue in the last version on Chrome. Applying
It won’t be perfect (for max-height cases), but for any other case it’d be fixed |
Or how about listening to the overflow event? http://www.backalleycoder.com/2013/03/14/oft-overlooked-overflow-and-underflow-events/ |
Reported by @brianmhunt
http://jsfiddle.net/cBcTq/3/
The text was updated successfully, but these errors were encountered: