mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-17 02:10:39 +03:00
chore: perfect scrollbar wrapper to maintain initial offset
This commit is contained in:
parent
35ba10f759
commit
5ebab5f942
|
@ -27,7 +27,9 @@ export class PerfectScrollbar extends React.Component<{
|
||||||
private inst: PerfectScrollbarType;
|
private inst: PerfectScrollbarType;
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const offset = (this._container.parentElement && this._container.parentElement.scrollTop) || 0;
|
||||||
this.inst = new PerfectScrollbarConstructor(this._container, this.props.options || {});
|
this.inst = new PerfectScrollbarConstructor(this._container, this.props.options || {});
|
||||||
|
this._container.scrollTo(0, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
|
|
|
@ -21,6 +21,13 @@ export class MenuItem extends React.Component<MenuItemProps> {
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const item = this.props.item;
|
||||||
|
if (item.type !== 'group' && item.active) {
|
||||||
|
this.scrollIntoView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
if (this.props.item.active) {
|
if (this.props.item.active) {
|
||||||
this.scrollIntoView();
|
this.scrollIntoView();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user