Skip to content

Conversation

@LeeWxx
Copy link
Contributor

@LeeWxx LeeWxx commented Oct 11, 2025

#14665

Remote form fields expose field.touched() so apps can see whether a field or its children were interacted with, and client/server runtimes surface the existing touched map.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@changeset-bot
Copy link

changeset-bot bot commented Oct 11, 2025

🦋 Changeset detected

Latest commit: bdedd6e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

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

@LeeWxx LeeWxx force-pushed the feature/add-field-touched-accessor branch from 01012dd to b503fd7 Compare October 11, 2025 09:53
@hrueger
Copy link

hrueger commented Oct 19, 2025

Just tested it, works great for me! 👍

@hrueger
Copy link

hrueger commented Oct 22, 2025

Sorry for asking here about the status again - we're desperately waiting for this feature and this pr has been unreviewed for almost 2 weeks now 🤷‍♂️

Is there anything that can be done to help get this reviewed soon(ish)? Thanks in advance!

@LeeWxx do you think, you can request a review from maintainers?

@LeeWxx LeeWxx force-pushed the feature/add-field-touched-accessor branch from b503fd7 to 878e77c Compare October 24, 2025 10:42
@LeeWxx
Copy link
Contributor Author

LeeWxx commented Oct 24, 2025

@hrueger I don’t think I have permission to request reviewers either.
Do you happen to know if there’s any other way to get this reviewed?

@hrueger
Copy link

hrueger commented Oct 24, 2025

Very strange... I usually don't tag random people as I've heard it is considered rude. So hopefully Mr Svelte himself (aka @Rich-Harris) sees this as a friendly request for review? 😃🙏 thanks in advance!

@firatciftci
Copy link

I think it would be beneficial to differentiate (and individually support) both touched and dirty state for form fields, where the former checks for any modification from the original state (and remains touched once any modification occurs), and the latter keeps track of difference from original and current form state (where dirty would be false if all form fields are the same as original, even if touched is true).

@hrueger
Copy link

hrueger commented Oct 24, 2025

Ideally, I'd want to implement the following behavior:

  • I have a field, which can be plain, or outlined green or outlined red with a list of issues
  • at the beginning, the field is plain / idle
  • When the user types and the validation passes, it becomes green
  • when the user types more or removes chats so that the field becomes invalid, it should become red and the issue list should display
  • or when the user does not input valid content and the field is blurred, then it should become red

Note that when inputting for the first time, it only can become red after it was already green. So that you don't confuse the user with a min length issue for example while he is still typing.

Does that make sense? Hard to express in writing 😁

Would that be possible without manually keeping track of the validation success of each field? Maybe we need a blurredOnce tracker, too? Not sure.

@Antonio-Bennett
Copy link

@LeeWxx I think a good place would be the contributors channel in the svelte discord.

@LeeWxx
Copy link
Contributor Author

LeeWxx commented Oct 25, 2025

@firatciftci @hrueger I started with adding support for the touched state only in this PR to keep the scope small and focused. Once we agree on the purpose and desired behavior in the issue or discussion, I’m thinking of following up with another PR for dirty and related states. Would that make sense to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants