Skip to content

min-w-fit not working with virtualization in USelectMenu #5534

Open

Description

@fkwww27

Environment

  • Operating System: Linux
  • Node Version: v22.16.0
  • Nuxt Version: 4.2.1
  • CLI Version: 3.30.0
  • Nitro Version: 2.12.9
  • Package Manager: npm@10.9.2
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Is this bug related to Nuxt or Vue?

Nuxt

Package

v4.x

Version

v4.1.0

Reproduction

https://stackblitz.com/edit/uselectmenu-error

Description

When using the USelectMenu component with the virtualize option enabled, the min-w-fit class applied via the ui.content property does not behave correctly. The dropdown content does not resize to fit the longest item.
Without virtualization, the same configuration works as expected, the dropdown expands to show the full content width.

Additional context

Expected behavior:

Image

Unexpected behavior:

Image

Logs

Activity

  1. added
    bugSomething isn't working
    triageAwaiting initial review and prioritization
    on Nov 26, 2025
  2. plycos commented on Dec 7, 2025

    @plycos

    I think this is a limitation of how virtualization works. When virtualization is enabled, the items in the select list are absolutely positioned, which means that intrinsic layout calculations for width and height cannot impact the parent container since they're no longer part of the normal document flow.

    You can work around this by either precalculating the width and applying it during onMounted or by setting an explicit width on the content.

  3. fkwww27 commented on Dec 8, 2025

    @fkwww27
    Author

    I tried using truncate, but then the items started overlapping and it looked wrong, specifically because they are absolutely positioned due to virtualization. I also don’t want to manually calculate widths, since that would be more of a workaround than a proper solution. Does anyone have a recommended solution for handling a select with virtualization and long option names so that the list remains readable?

  4. fkwww27 commented on Jan 8, 2026

    @fkwww27
    Author

    Any updates on this issue? Just following up after a month of inactivity. @benjamincanac

  5. pbartyla-code commented on Mar 6, 2026

    @pbartyla-code

    The problem is still present in version 4.5.1. Is there any update on when this might be fixed?

  6. benjamincanac commented on Mar 10, 2026

    @benjamincanac
    Member

    Unfortunately, I don't have a solution for this as items are absolutely positioned when using virtualize prop. However, it doesn't prevent you to specify the width you want: :ui="{ content: 'w-80' }".

  7. removed
    bugSomething isn't working
    p2-mediumNotable issue or useful enhancement
    v4#4488
    on Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions