themesberg / themesberg/flowbite
Very bad performance of DropDown component
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 9.4k
- Forks
- 862
- PR merge metrics
- No merged PRs in 30d
Description
I noticed on my project that scrolls on comment page are very laggy, and found the DropDown component to be the problem.
I tried striping everything else that may be causing this, but even for the most minimal setup the issue persist.
To Reproduce
I just print plane html with php like this, with 100 components on page.
dropDown.txt
<div>
@for($i=0;$i<100;$i++)
<div class="h-10">
<button id="dropdownComment{{$i}}Button" data-dropdown-toggle="dropdownComment{{$i}}" type="button"></button>
<div id="dropdownComment{{$i}}" class="hidden"></div>
</div>
@endfor
</div>
<link href="https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.8.1/flowbite.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.8.1/flowbite.min.js"></script>
Screenshots
As you can see out of 1.63 s of scrolling, 991 ms spent on scripting.
Desktop
- OS: MacOs
- Browser Chrome
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached dropDown.txt reproduction and the flowbite.min.js entry point, then profile scrolling with 100 DropDown components in Chrome. Inspect the DropDown component's runtime behavior and compare it with the reported 1.63-second scroll and 991 ms of scripting. Done means the minimal reproduction no longer exhibits the reported lag and the result is verified against this setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, tailwindcss
- Domain
- frontend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100