-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
add bind:inputEl to textarea in TextField #531
base: main
Are you sure you want to change the base?
Conversation
Run & review this pull request in StackBlitz Codeflow. |
|
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
@@ -366,7 +367,7 @@ | |||
{max} | |||
{step} | |||
{actions} | |||
bind:inputEl | |||
bind:inputEl={null, (el) => (inputEl = el ?? null)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is using function bindings as defined here. The problem was that svelte thought we wanted to provide the value from TextField to Input, and since inputEl
now may be a TextArea it was not happy with that since there's missing properties. This ensures that data flow is only one way out of the Input and into the TextField variable. I would have put a comment in code but there's not a good way to do that here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @hahn-kev. As of right now Svelte UX supports Svelte 3-5 (and will be for 1.x, but will be Svelte 5 only). I plan to release Svelte UX 1.0 VERY soon (maybe later this week) and have a PR that has started the migration to Svelte 5, but there is a lot of regression testing and refinements that need done.
With that said, we won't be able to use Svelte 5 function bindings yet (the docs are running Svelte 5 so it succeeds).
Here's my rough plan for Svelte UX 2.x (and others). Once we start the next
branch I would love to include this, and plan to have incremental releases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh ok, I didn't realize that was a svelte 5 feature. I've changed this to do the same thing but an object to act as a wrapper which lets us define a setter without a getter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice technique! Care to run pnpm format
to fix the prettier lint issue and I'll merge / release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, could you add an example or a way to validate the change. I don't have any component tests at the moment, just some unit tests and a lot of examples for visual/manual validation
closes #357
I didn't test this as I just checked out this repo for this simple change, I'm assuming CI will catch any issues this causes (if any)