Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Autocomplete section overlap due to incorrect itemHeight with virtualization #4568

Closed
thatkev opened this issue Jan 16, 2025 · 7 comments · Fixed by #4822
Closed
Assignees
Labels
📋 Scope : Docs Related to the documentation

Comments

@thatkev
Copy link

thatkev commented Jan 16, 2025

NextUI Version

2.6.11

Describe the bug

AutocompleteSection, when containing too many AutocompleteItems, seems to have the category text (and occasional items) overlap. This behaviour is pertinent to all tested major browsers (Chromium-based browsers, Safari, Firefox).

Your Example Website or App

https://stackblitz.com/~/github.com/thatkev/autocomplete-bug
https://github.com/thatkev/autocomplete-bug

Steps to Reproduce the Bug or Issue

  1. Start dev server, visit the root page.
  2. Click the dropdown, scroll and observe the bug.

Expected behavior

I expect that AutocompleteSection and AutocompleteItem are appropriately spaced, and do not overlap.

Screenshots or Videos

image
image

Operating System Version

macOS Sequoia 15.3 Beta (24D5034f)

Browser

Chrome

Copy link

linear bot commented Jan 16, 2025

@wingkwong wingkwong added the 🐛 Type: Bug Something isn't working label Jan 16, 2025
@jrgarciadev
Copy link
Member

@wingkwong please check

@thatkev
Copy link
Author

thatkev commented Jan 19, 2025

Issue cause has been pinpointed to virtualization- disabling it resolves the issue.

@GuntreddyHemanth
Copy link

GuntreddyHemanth commented Feb 5, 2025

@jrgarciadev Please assign it to me!

@wingkwong wingkwong assigned ryo-manba and unassigned wingkwong Feb 5, 2025
@ryo-manba
Copy link
Collaborator

The issue occurs because an incorrect itemHeight is being passed during virtualization.

virtualization: shouldVirtualize
? {
maxListboxHeight,
itemHeight,
}

Since startContent dynamically changes the list height, the correct itemHeight must be provided.

autocomplete.virtualization.fix.height.mov

I’ll update the docs to note that startContent with virtualization requires the correct itemHeight.

Just a side note, I also tried dynamically measuring the list item height and applying it to the virtualizer, but it didn’t work as expected... 😓

@ryo-manba ryo-manba added 📋 Scope : Docs Related to the documentation and removed 🐛 Type: Bug Something isn't working labels Feb 11, 2025
@ryo-manba ryo-manba changed the title [BUG] - Autocomplete section overlap [BUG] - Autocomplete section overlap due to incorrect itemHeight with virtualization Feb 11, 2025
@thatkev
Copy link
Author

thatkev commented Feb 11, 2025

@ryo-manba What if not all items have startContent? Won’t this throw off the formatting?

@ryo-manba
Copy link
Collaborator

As it stands, the only option is to set isVirtualized={false}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📋 Scope : Docs Related to the documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants