Andarist / Andarist/react-textarea-autosize

Initial height is incorrect in Firefox

Open
#366 5 comments 4 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.4k
Forks
247
PR merge metrics
No merged PRs in 30d

Description

I'm working on migrating to this package from `react-textarea-autosize` (because it isn't maintained anymore and doesn't support React 18) in a large project (https://github.com/WordPress/gutenberg/pull/48215)

I've come across a bug where the initial height is sometimes calculated incorrectly. This bug only happens in Firefox, not Chrome or Safari.

We have a large editor which has a WYSIWYG mode, and a plain-text/HTML mode. Typically, you edit in the visual editor, but may need to switch to the "code" editor for some things. This code editor uses the autosize textarea. I've found that if the editor uses the autosize textarea on _first page load_, it is the correct size. However, if we switch to the textarea _after_ the first page load, it doesn't calculate the height properly (and just uses min rows/min height).

After interacting with the textarea, or even resizing the page, it adjusts to the correct size.

https://user-images.githubusercontent.com/6265975/219794503-2f3282f2-0395-4839-a3e7-f7dc115d0131.mp4

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.