-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
fix: update error message to clarify usage with radio inputs #16874
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
fix: update error message to clarify usage with radio inputs #16874
Conversation
🦋 Changeset detectedLatest commit: 926f9a5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
e.bind_invalid_target( | ||
node, | ||
node.name, | ||
`<input type="checkbox"> - for <input type="radio">, use 'group' binding` |
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.
Please let me know if there are better message.
## `<input bind:checked>` | ||
|
||
Checkbox and radio inputs can be bound with `bind:checked`: | ||
Checkbox can be bound with `bind:checked`: |
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.
Checkbox can be bound with `bind:checked`: | |
Checkbox inputs can be bound with `bind:checked`: |
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.
Modified.
e.bind_invalid_target( | ||
node, | ||
node.name, | ||
`<input type="checkbox"> - for <input type="radio">, use 'group' binding` |
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.
In svelte 4 the last part was only in the error message if you tried to use it with type="radio"
.
Not sure if we want to keep it like that.
`<input type="checkbox"> - for <input type="radio">, use 'group' binding` | |
`<input type="checkbox">${type.value[0].data === 'radio' ? ` — for <input type="radio">, use 'group' binding` : ''}` |
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.
Modified.
I have a same experience of using bind:checked
with radio input.
At that time, I went to the official doc and realized we should use group
bind.
From that my experience, keeping extra message is friendly for developers but it is not necessary.
|
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.
thank you!
closes #16870
Description
Change error message for radio input checked binding.
Before:
After:
Docs screenshot
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint