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

Ensure Select onScroll is bound to the Popover, not the listbox #1864

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

acelaya
Copy link
Contributor

@acelaya acelaya commented Jan 31, 2025

This PR fixes a regression that was likely introduced when the Popover component was implemented.

That made the Select's onListboxScroll to never be invoked again, as due to the new DOM structure, the element that ends up with scroll is not the listbox, but the popover itself.

This PR deprecates onListboxScroll, and adds a new onPopoverScroll prop to replace it (its default value is whatever was passed to onListboxScroll, for backwards compatibility), and also makes sure the onPopoverScroll is passed to the right DOM element.

This PR is part of https://github.com/hypothesis/support/issues/178

@acelaya acelaya force-pushed the fix-popover-on-scroll branch 2 times, most recently from 2daf7a3 to 2c211ec Compare January 31, 2025 10:26
Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (edf6957) to head (629ce95).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1864   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           70        70           
  Lines         1306      1307    +1     
  Branches       482       483    +1     
=========================================
+ Hits          1306      1307    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@acelaya acelaya force-pushed the fix-popover-on-scroll branch 2 times, most recently from 0c46e70 to 74063a3 Compare January 31, 2025 10:48
@acelaya acelaya marked this pull request as ready for review January 31, 2025 10:49
@acelaya acelaya requested a review from robertknight January 31, 2025 10:49
@@ -455,6 +459,7 @@ function SelectMain<T>({
asNativePopover={listboxAsPopover}
align={alignListbox}
classes={popoverClasses}
onScroll={onPopoverScroll}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The overflowing and height controls are on the Popover now, so that's the element where we should listen for onScroll.

@acelaya acelaya force-pushed the fix-popover-on-scroll branch from 9b430d2 to 629ce95 Compare January 31, 2025 11:10
@acelaya acelaya merged commit 1d6a1ca into main Jan 31, 2025
2 checks passed
@acelaya acelaya deleted the fix-popover-on-scroll branch January 31, 2025 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants