[select] Fix scroll height loop#3795
Conversation
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
222444a to
88cc468
Compare
Greptile SummaryFixed an infinite scroll loop in the select popup component caused by floating-point precision issues during height and scroll calculations. The fix introduces a 1-pixel epsilon constant ( Key changes:
Confidence Score: 5/5
Important Files Changed
|
|
This is a more widespread bug. The The MDN article (https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#determine_if_an_element_has_been_totally_scrolled) even calls this out and says that the only way to determine if an element is completely scrolled is (although I'd use a 2px threshold because I've scrolled to the bottom and had There is at least one other bug caused by this also - So it would be nice to have a more general solution. |
|
@tcrognon can you make an issue for Scroll Area? The Select popup scroll logic is self contained and doesn't affect other components |
9413071 to
488292e
Compare
8acc7c3 to
b0ef626
Compare
b0ef626 to
9a12671
Compare
|
Thanks for fixing this @atomiks! I'm excited to go back to the OSX style select drop downs in my app. One thing I missed drawing attention to was the |
Can't reproduce this at all on our docs (or a simple Vite demo) but in the Stackblitz it's reproducible.
Chrome; browser window height 857px (various smaller values work too)
Master: https://stackblitz.com/edit/43a3dxj7
This PR: https://stackblitz.com/edit/43a3dxj7-tfa2kpiz
Fixes #3789