Skip to content

fix(components): resolve form field props and cancel pending search term reset - #6834

Open
benjamincanac wants to merge 2 commits into
v4from
fix/form-field-prop-resolution
Open

fix(components): resolve form field props and cancel pending search term reset#6834
benjamincanac wants to merge 2 commits into
v4from
fix/form-field-prop-resolution

Conversation

@benjamincanac

Copy link
Copy Markdown
Member

🔗 Linked issue

❓ Type of change

  • 📖 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

A few small fixes around how form controls resolve their props.

FileUpload read props.size and props.disabled directly instead of going through useFormField, so a wrapping <UFormField size="xl"> or <UForm disabled> didn't reach it. Both now resolve through the composable, and the resolved size is forwarded to the file avatars and the delete button, which still read the raw prop and would otherwise stay at md while the dropzone scaled.

disabled uses || rather than ?? on the theme fallback on purpose. disabled is a Boolean prop with no withDefaults entry, so Vue casts it to false when unset and a ?? fallback can never fire, which would have dropped the app.config / <UTheme :props> path the previous props.disabled had.

CheckboxGroup forwards the resolved color and size to its items, so theme defaults reach the checkboxes. Without it, <UTheme :props="{ checkboxGroup: { color: 'success' } }"> styled nothing: the items are UCheckbox, so their own proxy reads app.config.ui.checkbox and never checkboxGroup, and useFormField blocks the field injection for nested inputs so they can't pick it up from there either. It matters more than it looks, because every color variant in the checkbox-group theme is an empty object outside the table compound variants, so forwarding is the only thing that prop does on the default list variant.

highlight is deliberately left alone. It hits the same Boolean cast as disabled above, and || there would let a theme default override an explicit highlight={false}, so the fix belongs in the prop declaration rather than the call site.

SelectMenu / InputMenu declared timeoutId inside onUpdateOpen, so the clearTimeout in the reopen branch always cleared undefined and the pending searchTerm reset fired anyway. Hoisting it to setup scope makes the cancel work, so reopening a menu within 100ms keeps the typed filter instead of silently wiping it.

The rest is dropping ?. on a few size computeds that are never undefined (Input, InputTags, Textarea, and the same two menus).

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

…erm reset

FileUpload resolves `size` and `disabled` through `useFormField` and forwards the resolved size to its avatars and delete button. CheckboxGroup forwards the resolved color and size to its items so theme defaults reach them. SelectMenu and InputMenu hoist `timeoutId` out of `onUpdateOpen` so the `clearTimeout` on reopen is no longer a no-op.
@github-actions github-actions Bot added the v4 #4488 label Aug 12, 2026
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

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: b97b3e81-8fc6-4322-ba8b-988795bbd1ca

📥 Commits

Reviewing files that changed from the base of the PR and between ce489e8 and 05ad753.

📒 Files selected for processing (7)
  • src/runtime/components/CheckboxGroup.vue
  • src/runtime/components/FileUpload.vue
  • src/runtime/components/Input.vue
  • src/runtime/components/InputMenu.vue
  • src/runtime/components/InputTags.vue
  • src/runtime/components/SelectMenu.vue
  • src/runtime/components/Textarea.vue

📝 Walkthrough

Walkthrough

The update applies resolved form-field values to checkbox and file-upload controls. It standardizes direct access to computed size values across input components. It also retains timeout identifiers in InputMenu and SelectMenu so pending delayed resets can be cancelled when menus reopen.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main fixes for form-field prop resolution and pending search-term reset cancellation.
Description check ✅ Passed The description directly explains the changes to form controls, theme defaults, and timeout cancellation.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/form-field-prop-resolution

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/runtime/components/CheckboxGroup.vue

Parsing error: Unexpected token )

src/runtime/components/FileUpload.vue

Parsing error: Unexpected token )

src/runtime/components/Input.vue

Parsing error: Unexpected token )

  • 4 others

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.

@codspeed-hq

codspeed-hq Bot commented Aug 12, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing fix/form-field-prop-resolution (4a1a01a) with v4 (edf73d3)

Open in CodSpeed

@pkg-pr-new

pkg-pr-new Bot commented Aug 12, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxt/ui@6834

commit: 4a1a01a

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

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant