Skip to content

style being spread via $$restProps is reset by bind:value in <textarea> #9128

@brunnerh

Description

@brunnerh

Describe the bug

When a style is set on a component and the style of the element is being modified by resize (which sets width/height), those style changes can be lost on component update due to another property, even though the passed in style did not actually change (e.g. if it is set to be a constant value).

(A workaround is to export a style property explicitly, so it is not part of the spread attributes.)

Reproduction

<!-- TextArea.svelte -->
<script>
	export let value = '';
</script>

<textarea bind:value {...$$restProps} />
<TextArea bind:value={someValue} style="width: 100%" />

REPL

Steps:

  • Resize textarea
  • Type into textarea

Logs

No response

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
    Memory: 7.14 GB / 31.69 GB
  Binaries:
    Node: 18.16.0 - ~\AppData\Local\Programs\NodeJS\node.EXE
    Yarn: 1.22.19 - ~\AppData\Local\Programs\NodeJS\yarn.CMD
    npm: 9.5.1 - ~\AppData\Local\Programs\NodeJS\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (115.0.1901.203)
    Internet Explorer: 11.0.22000.120

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions