What steps will reproduce the problem?
- create a p:textArea with autoResize=true (default)
- set its width to 100% using CSS (make sure it's significantly wider than it would by by just specifying the cols-value)
- start typing and see when it starts to resize
3.3.SNAPSHOT (2012/05/07)
What is the expected output? What do you see instead?
I'd expect the text area to start resizing once the content comes close to the right corner at the bottom.
Instead, the area starts resizing way before that.
Which JSF implementation with version are you using?
Mojarra 2.1.6
Which component libraries are you using in addition to PrimeFaces?
PrimeFaces Extensions
Which application server or servlet container are you using?
vFabric 2.6.5 (Tomcat 7.0.27)
Example
- Go to http://www.primefaces.org/showcase-labs ... xtarea.jsf
- Set the width of the upper text area to 100% using Firebug (or a tool of your choice)
- Start typing and the text area will start resizing way before the text reaches the bottom
From what I understand the text area widget's resize function is based on the number of columns. This calculation doesn't work once the text area is overruled by CSS. I find this solution quite elegant as it doesn't involve any calculations and even works with IE6-7.
What they suggest is basically this: wrap the text-area in a div and let the text-area expand to it. Whenever the text inside the text-area changes it's mirrored into the surrounding div which therefore expands automatically and with it the text-area.