solid icon indicating copy to clipboard operation
solid copied to clipboard

Textarea with static value-property does not set its value.

Open bigmistqke opened this issue 4 months ago • 0 comments

Describe the bug

When setting the value of a textarea with a static string, it does not set the property, while if you set the value while calling a function it does get set.

function Counter() {
  const [signal] = createSignal("dynamic");
  return (
    <>
      {/* Does not set value */}
      <textarea
        value="static"
        ref={(element) => {
          console.log("1 static:", element.value);
          queueMicrotask(() => console.log("2 static:", element.value));
        }}
      />
      {/* Sets value */}
      <textarea
        value={signal()}
        ref={(element) => {
          console.log("1 dynamic:", element.value);
          queueMicrotask(() => console.log("2 dynamic:", element.value));
        }}
      />
      {/* Sets value too */}
      <textarea
        value={(() => "iife")()}
        ref={(element) => {
          console.log("1 iife:", element.value);
          queueMicrotask(() => console.log("2 iife:", element.value));
        }}
      />
    </>
  );
}

Your Example Website or App

https://playground.solidjs.com/anonymous/54d80eb1-0ae9-4016-8300-e8f058f975d9

Steps to Reproduce the Bug or Issue

<textarea value="static" />

Expected behavior

The value of the textarea to be "static", but instead it is "".

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

bigmistqke avatar Sep 27 '24 15:09 bigmistqke