-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
bind:clientWidth doesn't update for resizable element #6127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
These are "Block-level element bindings", But I think there should be a warning in this case. As a workaround wrap the element, but I think you are already aware of that https://svelte.dev/repl/9883af1a955148f0a57ca9caefa59e61?version=3.35.0 |
bind:this={node} > node.clientWidth... |
@Valexr maybe I misunderstand your comment, but this is not reactive. You'd have to poll it (e.g. using raf) which can be expensive because the browser might have to do layout every single time you access the |
D'oh, I thought "block element" referred to the CSS display property, rather than something else. It would be nice if svelte emitted error messages when a user binds to an element that svelte doesn't support that type of binding to. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Svelte 5 uses resize observers meaning this works perfectly, so I'll close this |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
<textarea bind:clientWidth>
doesn't updateclientWidth
when textarea is resized by user.To Reproduce
repl example
Expected behavior
On user resize of textarea, I expected the bound value to update. Instead, the values stay stuck at the initial size.
Severity
Low. This is easy to work around, it would just be cleaner if this worked. Or in the alternative, if the documentation made it clear this wouldn't work.
The text was updated successfully, but these errors were encountered: