Skip to content

[RAC] Allow adding onScroll handlers for table components #8040

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

Open
lukpsaxo opened this issue Apr 7, 2025 · 2 comments · May be fixed by #8150
Open

[RAC] Allow adding onScroll handlers for table components #8040

lukpsaxo opened this issue Apr 7, 2025 · 2 comments · May be fixed by #8150

Comments

@lukpsaxo
Copy link
Contributor

lukpsaxo commented Apr 7, 2025

Provide a general summary of the feature here

We would like onScroll as a prop on the TableBody.

🤔 Expected Behavior?

ability to pass onScroll in the table body and pass it on to the react element.

😯 Current Behavior

only aria label props get passed down.

💁 Possible Solution

include a list of allowed events in the filter props call to allow events to be subscribed.

🔦 Context

We have a complex table built on top of the react aria components table which does a sticky heading and sticky columns and our own virtualizer (due to this #7820).

We currently have to attach scroll events to the ref, but we would love to just be able to pass onScroll down to the TableBody.

@snowystinger mentioned to raise this as a seperate request: #7987 (comment)

We are happy to contribute a PR, just let us know if you are ok with this proposal.

💻 Examples

No response

🧢 Your Company/Team

Saxo Bank

🕷 Tracking Issue

No response

@lukpsaxo
Copy link
Contributor Author

lukpsaxo commented Apr 7, 2025

more detail provided here: #7987 (comment)

@snowystinger
Copy link
Member

Inlining my comment for ease of readability:

We had some scroll syncing at one point in our React Spectrum implementation. I forget when we started S2 implementation if we would have needed to add something for that or if we had a want to handle it already. Could you open a discussion or issue about it?

Also, it might be something that you could solve with our Virtualizer more easily, scroll syncing can get a bit janky due to the async nature of the scrolling.
See https://react-spectrum.adobe.com/react-aria/Virtualizer.html
And our sticky column implementation https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/layout/src/TableLayout.ts#L34
it only does the selection column right now, but could probably be extended to more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants