Skip to content

feat: add dirty() method to form fields, improve validation skipping logic - #16208

Merged
Rich-Harris merged 10 commits into
version-3from
touched-and-dirty
Jul 2, 2026
Merged

Rich-Harris merged 10 commits into
version-3from
touched-and-dirty

Conversation

@Rich-Harris

Copy link
Copy Markdown
Member

Follow-up to #14692. This exposes a dirty() method on form fields, which is separate from touched() — it only becomes true once a value is actually edited (whether via user input or programmatically, after the form has mounted).

It also improves the logic around myform.validate() — rather than validating all fields that have been touched by default, it now only validates fields that are touched and dirty, meaning the user has edited a field and then blurred it (or it was set programmatically), which matches accessibility guidelines.

To validate every field regardless of dirty state, do myform.validate({ all: true }).

Draft because I guess we should add a test


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

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.

Loading
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.

2 participants