Skip to content

Commit

Permalink
ScrollablePane: Moves onScroll from root element to container (#20123)
Browse files Browse the repository at this point in the history
* Moves onScroll method on ScrollablePane from root to container

* Change files

* Using excludedPropNames instead of undefining the onScroll prop.

* Using excludedPropNames instead of undefining the onScroll prop.

Co-authored-by: KHMakoto <Humberto.Morimoto@microsoft.com>
  • Loading branch information
bsunderhus and khmakoto committed Apr 19, 2022
1 parent 6da8d2a commit d3afef1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
@@ -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"
}
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

0 comments on commit d3afef1

Please sign in to comment.