diff --git a/.changeset/two-turkeys-join.md b/.changeset/two-turkeys-join.md new file mode 100644 index 00000000..d61c104e --- /dev/null +++ b/.changeset/two-turkeys-join.md @@ -0,0 +1,5 @@ +--- +'react-textarea-autosize': patch +--- + +Force `display: block` for the hidden textarea to prevent other styles from overriding it and thus breaking the resizing functionality diff --git a/src/calculateNodeHeight.ts b/src/calculateNodeHeight.ts index 834e43d6..c1d7ca3d 100644 --- a/src/calculateNodeHeight.ts +++ b/src/calculateNodeHeight.ts @@ -1,5 +1,5 @@ -import { SizingData } from './getSizingData'; import forceHiddenStyles from './forceHiddenStyles'; +import { SizingData } from './getSizingData'; // TODO: use labelled tuples once they are avaiable: // export type CalculatedNodeHeights = [height: number, rowHeight: number]; diff --git a/src/forceHiddenStyles.ts b/src/forceHiddenStyles.ts index 288160e9..3f90a800 100644 --- a/src/forceHiddenStyles.ts +++ b/src/forceHiddenStyles.ts @@ -8,6 +8,7 @@ const HIDDEN_TEXTAREA_STYLE = { 'z-index': '-1000', top: '0', right: '0', + display: 'block', } as const; const forceHiddenStyles = (node: HTMLElement) => {