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

MinRows on Firefox with Border-box

Open MonstraG opened this issue 3 years ago • 10 comments

Example 3 on https://andarist.github.io/react-textarea-autosize/ image

It looks fine on Chrome, broken on Firefox 86

MonstraG avatar Mar 16 '21 12:03 MonstraG

I've console.log'd onHeightChange, and on my page ff reports rowHeight of 7 and Chrome - 17, the issue lies in calculation of rowHeight it seems.

MonstraG avatar Mar 16 '21 13:03 MonstraG

PRs, especially for bug fixes, are very welcome here. It would also have to come with a proper explanation as to why the bug happens here in the first place.

Andarist avatar Mar 16 '21 13:03 Andarist

It seems like, on Firefox 87, size calculation is broken wholesale. It appears to be due to a Firefox bug, as it works in Firefox Nightly as of 2021-03-26.

image

It looks like Firefox is under-reporting the value of scrollHeight here, giving the same value for one line of text as zero lines, leading it to calculate that rowHeight is 0, at least on my machine. Strange that @MonstraG and I are seeing different results. Since it's to do with scroll padding, this bug may have fixed it? https://bugzilla.mozilla.org/show_bug.cgi?id=1696885

cpmsmith avatar Mar 26 '21 18:03 cpmsmith

I got also an issue with maxRows. It works in firefox beta 89, so nothing the library can do I think...

ArnaudBarre avatar May 11 '21 21:05 ArnaudBarre

Firefox 89 started shipping today, fixing this.

cpmsmith avatar Jun 01 '21 15:06 cpmsmith

That's great to hear!

Andarist avatar Jun 01 '21 16:06 Andarist

Seeing this issue with latest Firefox on macos, and we aren't setting the max, but the height on initial render is as if there is only one line: height: 20px instead of the 70px that it should be.

I think https://github.com/Andarist/react-textarea-autosize/issues/313#issuecomment-800240110 is correct that it has to do with calculation for row height.

knownasilya avatar Oct 17 '22 21:10 knownasilya

The interesting bit, is that you can't reproduce it if you have devtools breakpoints active. It has something to do with timing in FF I believe. getHeight returns 0 in this case, meaning the scrollHeight of the element isn't reflecting the value in the element. So it is a Firefox bug, and it isn't fixed yet it seems. The linked issue seems unrelated.

knownasilya avatar Oct 18 '22 14:10 knownasilya

Here's a reproduction https://codepen.io/tgknownasilya/pen/wvjboOo Bug submitted: https://bugzilla.mozilla.org/show_bug.cgi?id=1795904

knownasilya avatar Oct 18 '22 14:10 knownasilya

@Andarist could you review https://github.com/Andarist/react-textarea-autosize/pull/353

knownasilya avatar Oct 18 '22 15:10 knownasilya