This commit is contained in:
Timothy Jaeryang Baek
2026-07-26 17:51:49 -04:00
parent c882222f68
commit 421834b2de
2 changed files with 114 additions and 445 deletions
+8 -8
View File
@@ -4,18 +4,18 @@
export let value = '';
export let placeholder = '';
export let rows = 1;
export let minSize = null;
export let maxSize = null;
export let minSize: number | null = null;
export let maxSize: number | null = null;
export let required = false;
export let readonly = false;
export let className =
'w-full rounded-lg px-3.5 py-2 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden h-full';
export let ariaLabel = null;
export let ariaLabel: string | null = null;
export let onInput = () => {};
export let onBlur = () => {};
export let onInput: (event: Event) => void = () => {};
export let onBlur: (event: FocusEvent) => void = () => {};
let textareaElement;
let textareaElement: HTMLTextAreaElement | null = null;
// Adjust height on mount and after setting the element.
onMount(async () => {
@@ -38,7 +38,7 @@
// Find all ancestors that currently have an active scroll offset.
// This is extremely fast because reading `scrollTop` on a clean layout doesn't trigger reflow,
// and it makes the fix 100% robust without relying on hardcoded CSS classes.
let activeScrollParents = [];
const activeScrollParents: { el: HTMLElement; top: number }[] = [];
let p = textareaElement.parentNode;
while (p && p !== document.body) {
if (p instanceof HTMLElement && p.scrollTop > 0) {
@@ -91,4 +91,4 @@
resize();
}}
on:blur={onBlur}
/>
></textarea>