Skip to content

Simplify focus and blur handler types - #186

Merged
fabian-hiller merged 2 commits into
mainfrom
fix/focus-blur-handler-types
Aug 9, 2026
Merged

Simplify focus and blur handler types#186
fabian-hiller merged 2 commits into
mainfrom
fix/focus-blur-handler-types

Conversation

@fabian-hiller

@fabian-hiller fabian-hiller commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary

  • change FieldElementProps focus and blur handlers to parameterless callbacks in Preact, Qwik, React, Solid, Svelte, and Vue
  • add type-level regression coverage and changelog entries
  • update the affected website API signatures and explain the handlers' lifecycle behavior

Why

The focus and blur handlers do not consume their framework event objects. They only update touched state and trigger the configured touch or blur validation. Framework-specific focus event types therefore made controlled component integrations require unnecessary casts and could conflict with component libraries that expose different event types.

Using () => void keeps the handlers compatible with native controls while making them easier to forward to custom components. Angular and React Native already used parameterless handlers; React Native now also has regression coverage.

Validation

  • framework type tests for Preact, React, React Native, Solid, Svelte, and Vue
  • production builds for all framework packages
  • ESLint and TypeScript checks for every affected framework, including Qwik
  • website ESLint and TypeScript checks
  • website client production build and static server/SSG build

Summary by CodeRabbit

  • Updates
    • Focus and blur field handlers now use simple parameterless callbacks across supported frameworks.
    • Field focus triggers touch validation, while blur triggers blur validation.
  • Documentation
    • Updated API references and changelogs to explain the new callback signatures and validation behavior.
  • Tests
    • Added type checks confirming focus and blur handlers accept no arguments.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4851b3b2-7084-4f54-b67c-88ca6be3d4d1

📥 Commits

Reviewing files that changed from the base of the PR and between 3a5d7ef and 65a68a0.

📒 Files selected for processing (6)
  • frameworks/preact/src/types/field.ts
  • frameworks/qwik/src/types/field.ts
  • frameworks/react/src/types/field.ts
  • frameworks/solid/src/types/field.ts
  • frameworks/svelte/src/types/field.ts
  • frameworks/vue/src/types/field.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • frameworks/vue/src/types/field.ts
  • frameworks/qwik/src/types/field.ts
  • frameworks/react/src/types/field.ts
  • frameworks/preact/src/types/field.ts
  • frameworks/solid/src/types/field.ts
  • frameworks/svelte/src/types/field.ts

Walkthrough

FieldElementProps focus and blur handlers now use parameterless () => void callbacks across Preact, Qwik, React, Solid, Svelte, and Vue. Type-level tests, changelogs, and API documentation were updated to match the new contracts and validation behavior.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change to focus and blur handler types.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@fabian-hiller
fabian-hiller marked this pull request as ready for review August 8, 2026 23:57
Copilot AI lite review requested due to automatic review settings August 8, 2026 23:57
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Aug 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes FieldElementProps focus/blur handler typings across framework wrappers by switching them to parameterless callbacks, aligning the API with actual handler behavior (touched/validation) and reducing friction when forwarding handlers to custom components with differing event types.

Changes:

  • Update FieldElementProps focus/blur handler types to () => void (and QRL<() => void> for Qwik) across Preact, Qwik, React, Solid, Svelte, and Vue.
  • Add type-level regression tests to ensure focus/blur handlers remain parameterless.
  • Update website API docs to reflect the new signatures and document the handlers’ touched/validation lifecycle.

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.

Show a summary per file
File Description
website/src/routes/(docs)/vue/api/(types)/FieldElementProps/properties.ts Update Vue docs type signature for onFocus/onBlur to parameterless functions.
website/src/routes/(docs)/vue/api/(types)/FieldElementProps/index.mdx Document lifecycle behavior and parameterless handler rationale for Vue.
website/src/routes/(docs)/svelte/api/(types)/FieldElementProps/properties.ts Update Svelte docs type signature for onfocus/onblur to parameterless functions.
website/src/routes/(docs)/svelte/api/(types)/FieldElementProps/index.mdx Document lifecycle behavior and parameterless handler rationale for Svelte.
website/src/routes/(docs)/solid/api/(types)/FieldElementProps/properties.ts Update Solid docs type signature for onFocus/onBlur to parameterless functions.
website/src/routes/(docs)/solid/api/(types)/FieldElementProps/index.mdx Document lifecycle behavior and parameterless handler rationale for Solid.
website/src/routes/(docs)/react/api/(types)/FieldElementProps/properties.ts Update React docs type signature for onFocus/onBlur to parameterless functions.
website/src/routes/(docs)/react/api/(types)/FieldElementProps/index.mdx Document lifecycle behavior and parameterless handler rationale for React.
website/src/routes/(docs)/qwik/api/(types)/FieldElementProps/properties.ts Update Qwik docs type signature for onFocus$/onBlur$ callbacks to parameterless functions.
website/src/routes/(docs)/qwik/api/(types)/FieldElementProps/index.mdx Document lifecycle behavior and parameterless handler rationale for Qwik wrapped callbacks.
website/src/routes/(docs)/preact/api/(types)/FieldElementProps/properties.ts Update Preact docs type signature for onFocus/onBlur to parameterless functions.
website/src/routes/(docs)/preact/api/(types)/FieldElementProps/index.mdx Document lifecycle behavior and parameterless handler rationale for Preact.
frameworks/vue/src/types/field.ts Change Vue FieldElementProps focus/blur handler types and update JSDoc semantics.
frameworks/vue/src/composables/useField/useField.test-d.ts Add Vue type regression coverage for parameterless focus/blur handlers.
frameworks/vue/CHANGELOG.md Add changelog entry for the handler type change.
frameworks/svelte/src/types/field.ts Change Svelte FieldElementProps focus/blur handler types and update JSDoc semantics; drop unused FocusEventHandler import.
frameworks/svelte/src/runes/useField/useField.test-d.ts Add Svelte type regression coverage for parameterless focus/blur handlers.
frameworks/svelte/CHANGELOG.md Add changelog entry for the handler type change.
frameworks/solid/src/types/field.ts Change Solid FieldElementProps focus/blur handler types and update JSDoc semantics.
frameworks/solid/src/primitives/useField/useField.test-d.ts Add Solid type regression coverage for parameterless focus/blur handlers.
frameworks/solid/CHANGELOG.md Add changelog entry for the handler type change.
frameworks/react/src/types/field.ts Change React FieldElementProps focus/blur handler types and update JSDoc semantics; drop unused FocusEventHandler import.
frameworks/react/src/hooks/useField/useField.test-d.ts Add React type regression coverage for parameterless focus/blur handlers.
frameworks/react/CHANGELOG.md Add changelog entry for the handler type change.
frameworks/react-native/src/hooks/useField/useField.test-d.ts Add React Native type regression coverage for parameterless focus/blur handlers.
frameworks/qwik/src/types/field.ts Change Qwik FieldElementProps focus/blur handler types to QRL<() => void> and update JSDoc semantics.
frameworks/qwik/CHANGELOG.md Add changelog entry for the handler type change.
frameworks/preact/src/types/field.ts Change Preact FieldElementProps focus/blur handler types and update JSDoc semantics; drop unused FocusEventHandler import.
frameworks/preact/src/hooks/useField/useField.test-d.ts Add Preact type regression coverage for parameterless focus/blur handlers.
frameworks/preact/CHANGELOG.md Add changelog entry for the handler type change.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 30 files

Re-trigger cubic

@fabian-hiller
fabian-hiller merged commit ee7b6a3 into main Aug 9, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants