Skip to content

fix(Select): trailing set as false#6302

Open
albertcito wants to merge 8 commits intonuxt:v4from
albertcito:fix/select-trailing-false
Open

fix(Select): trailing set as false#6302
albertcito wants to merge 8 commits intonuxt:v4from
albertcito:fix/select-trailing-false

Conversation

@albertcito
Copy link
Copy Markdown
Contributor

@albertcito albertcito commented Apr 6, 2026

🔗 Linked issue

Resolves #6287

❓ 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

  • I set the default value for trailing as undefined.
  • In the computed value isTrailing, if the trailing is false, it returns it.
    • I added this change only in Select and SelectMenu because if I modify useComponentIcons it makes fails a lot of test in other components.
  • I added tests for these changes

Why is this change required? What problem does it solve?

This is what the documentation says

trailing: boolean 👉 When true, the icon will be displayed on the right side.

I expect that the down arrow icons will not be displayed in the select input. But even if I add :trailing="false", the arrow is still there.

📝 Checklist

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

@github-actions github-actions bot added the v4 #4488 label Apr 6, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 6, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This pull request introduces a new trailing prop to the Select and SelectMenu components that enables explicit control over trailing icon visibility. Both components were updated to accept the prop (defaulting to undefined) and modified their trailing-icon rendering logic to force the icon to not display when trailing is explicitly set to false. The implementation includes playground examples demonstrating the feature and test coverage verifying that the trailing icon is conditionally rendered based on the prop value.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'fix(Select): trailing set as false' directly describes the main change—enabling the trailing prop to work when set to false in the Select component.
Linked Issues check ✅ Passed The PR addresses all coding requirements from issue #6287: adds trailing prop support to both Select and SelectMenu components, implements conditional logic to honor trailing=false, and includes comprehensive test coverage.
Out of Scope Changes check ✅ Passed All changes are scoped to the trailing prop functionality: Select and SelectMenu component updates, playground examples demonstrating the fix, and related test cases—no unrelated modifications present.
Description check ✅ Passed The description clearly explains the issue, the solution implemented, and why it was necessary. It references the linked issue #6287, specifies the exact changes made to the trailing prop logic in Select and SelectMenu components, and includes test additions.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/runtime/composables/useComponentIcons.ts`:
- Around line 45-48: The isTrailing computed currently treats an undefined
trailing prop the same as true when an icon is present, causing both isLeading
and isTrailing to be true; change isTrailing to only enable trailing when
trailing is explicitly true or when there is an explicit trailingIcon (and
respect trailing === false). Specifically, update the isTrailing computed (which
reads props.value.trailing, props.value.icon, props.value.loading,
props.value.trailingIcon) so it returns false if props.value.trailing === false,
returns true when props.value.trailing === true or when
!!props.value.trailingIcon, and do not infer trailing from the presence of
props.value.icon (leave default leading behavior intact); ensure loading is only
shown on trailing if trailing was explicitly enabled.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e2f1bd1f-f196-40d5-a173-5549e54d198a

📥 Commits

Reviewing files that changed from the base of the PR and between b566b48 and 3f1df0a.

📒 Files selected for processing (7)
  • playgrounds/nuxt/app/pages/components/select-menu.vue
  • playgrounds/nuxt/app/pages/components/select.vue
  • src/runtime/components/Select.vue
  • src/runtime/components/SelectMenu.vue
  • src/runtime/composables/useComponentIcons.ts
  • test/components/Select.spec.ts
  • test/components/SelectMenu.spec.ts

The icon is always display at least the trailing is set to false
I reverted the useComponentIcons changes and added the fix in the components. Because modifying useComponentIcons causes issues in other components
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 6, 2026

npm i https://pkg.pr.new/@nuxt/ui@6302

commit: 35c9d8e

@albertcito
Copy link
Copy Markdown
Contributor Author

That is the best I could do without modifying many other components. Furthermore—unfortunately—when I run npm run test locally, many of the tests fail. This means I cannot perform a complete verification of my changes before submitting this PR.

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.

USelect trailing false doesn't work

1 participant