You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(Form): re-enable fields before emitting error - #7217
📖 Documentation (updates to the documentation or readme)
🐞 Bug fix (a non-breaking change that fixes an issue)
👌 Enhancement (improving an existing functionality)
✨ New feature (a non-breaking change that adds functionality)
🧹 Chore (updates to the build process or auxiliary tools and libraries)
⚠️ Breaking change (fix or feature that would cause existing functionality to change)
📚 Description
The @error example in the Form docs scrolls to the first invalid field but never focuses it. With loadingAuto (on by default), onSubmitWrapper sets loading before validating, so every field is rendered disabled while validation runs. error is emitted from the catch block, before the finally that resets loading, so the handler runs while the inputs are still disabled in the DOM and focus() does nothing.
loading is now reset and the DOM flushed with nextTick() before error is emitted, so the fields are enabled again when the handler runs. Focus is still left to the handler; this only makes the existing example work. The success path is unchanged.
#6547 went at this with a focusOnError prop and was closed because focusing by default changes every existing form. This doesn't move focus at all, it only makes the handler from the docs work as written.
The new test reads the inputs' disabled state from inside the error handler. It sees [true, true] on v4 and [false, false] with this change.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 12b8bc03-3027-491e-954b-0d3b0381e69a
📥 Commits
Reviewing files that changed from the base of the PR and between 4629ed4 and a63b2e4.
📒 Files selected for processing: 2
src/runtime/components/Form.vue
test/components/Form.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
When form submission fails with FormValidationException, Form.vue clears loading and waits for Vue’s next update tick before emitting the error event. A regression test checks that both inputs are enabled when the error callback runs.
Validation failures now re-enable auto-disabled inputs before the error handler runs, allowing handlers to focus them. The added test checks their callback-time state; no actionable merge-blocking risk is apparent.
Pre-merge checks: 5
Check name
Status
Explanation
Description check
The description clearly explains the Form error-path fix, the disabled-field behavior, the use of nextTick(), and the added test.
Title check
The title concisely and accurately describes the main change: re-enabling form fields before emitting the error event.
Linked Issues check
The PR addresses #4612. In src/runtime/components/Form.vue, the validation-error path sets loading.value = false, waits for nextTick(), and then emits error. This re-enables the form fields be…
Out of Scope Changes check
The changes are limited to the Form error path and a focused regression test. The test directly verifies the behavior required by #4612. No unrelated product behavior or unrelated files are included i…
Docstring Coverage
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Full details: Linked Issues check
Explanation
The PR addresses #4612. In src/runtime/components/Form.vue, the validation-error path sets loading.value = false, waits for nextTick(), and then emits error. This re-enables the form fields before the existing error handler runs, so the handler can focus the invalid element. The added Form test verifies that both inputs are enabled inside the error callback. The PR does not add automatic focus, which matches the stated issue objective.
Full details: Out of Scope Changes check
Explanation
The changes are limited to the Form error path and a focused regression test. The test directly verifies the behavior required by #4612. No unrelated product behavior or unrelated files are included in the reviewed changes.
Full details: Docstring Coverage
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches
🧪 Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
Resolves #4612
❓ Type of change
📚 Description
The
@errorexample in the Form docs scrolls to the first invalid field but never focuses it. WithloadingAuto(on by default),onSubmitWrappersetsloadingbefore validating, so every field is rendereddisabledwhile validation runs.erroris emitted from thecatchblock, before thefinallythat resetsloading, so the handler runs while the inputs are still disabled in the DOM andfocus()does nothing.loadingis now reset and the DOM flushed withnextTick()beforeerroris emitted, so the fields are enabled again when the handler runs. Focus is still left to the handler; this only makes the existing example work. The success path is unchanged.#6547 went at this with a
focusOnErrorprop and was closed because focusing by default changes every existing form. This doesn't move focus at all, it only makes the handler from the docs work as written.The new test reads the inputs'
disabledstate from inside theerrorhandler. It sees[true, true]onv4and[false, false]with this change.📝 Checklist