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

ScrollablePane: Moves onScroll from root element to container #20123

Merged
merged 5 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Moves onScroll method on ScrollablePane from root to container",
"packageName": "@fluentui/react",
"email": "bsunderhus@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export class ScrollablePaneBase
}

public render(): JSX.Element {
const { className, scrollContainerFocus, scrollContainerAriaLabel, theme, styles } = this.props;
const { className, scrollContainerFocus, scrollContainerAriaLabel, theme, styles, onScroll } = this.props;
const { stickyTopHeight, stickyBottomHeight } = this.state;
const classNames = getClassNames(styles!, {
theme: theme!,
Expand All @@ -200,11 +200,26 @@ export class ScrollablePaneBase
role: 'group',
tabIndex: 0,
'aria-label': scrollContainerAriaLabel,
onScroll,
}
: {};
: {
onScroll,
};

return (
<div {...getNativeProps(this.props, divProperties)} ref={this._root} className={classNames.root}>
<div
{...getNativeProps(
{
...this.props,
},
divProperties,
// on React 17 onScroll is not being invoked on root element,
// as a fix this method will be provided to the container element
['onScroll'],
)}
ref={this._root}
className={classNames.root}
>
<div
ref={this._stickyAboveRef}
className={classNames.stickyAbove}
Expand Down