Repository navigation
Clear the cached textarea value on form reset - #58
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Mouse movement after reset can still disable autosizing because the cached height is not cleared.
1 open issue
What changed in this PR
Addresses textarea autosizing when the same multiline value is re-entered after a form reset.
Changes:
- Clears the previous-value cache on reset.
- Adds a browser regression page and instructions for running it.
| File | Description |
|---|---|
test/reset.html |
Checks initial sizing, reset, and same-value re-entry. |
src/index.js |
Clears the cached value during form reset. |
README.md |
Documents the browser regression page. |
Review effort: Max
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

After a form reset, entering the same multiline value again leaves the textarea at its default height. Moving the pointer over it before typing can also make autosizing treat the cleared height as a manual resize. Clear both cached values during reset.
The dependency-free browser regression covers initial sizing, reset, pointer movement and retyping the same value. It failed before the fix and passed in Chromium afterward; ESLint and both TypeScript builds passed. The existing npm test script has no tests; Firefox/WebKit were not run.