Skip to content

Commit

Permalink
remove auto height setting (#268)
Browse files Browse the repository at this point in the history
* remove auto height setting

* Update to cache scroll position
  • Loading branch information
sarah-storm authored Oct 10, 2024
1 parent c3f3066 commit e0e494d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/textarea/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import { getSelection } from './lib/utils';
const isHidden = el => el.offsetParent === null;

const update = ({ target }) => {
target.style.height = 'auto';
target.style.height = `${target.scrollHeight}px`;
const scrollCache = window.scrollY;
target.style.height = 'auto';
target.style.height = `${target.scrollHeight}px`;
window.scrollTo(0, scrollCache);
};
const initObserver = el => {
const observer = new MutationObserver(mutationsList => {
Expand Down

0 comments on commit e0e494d

Please sign in to comment.