mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 16:46:34 +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;
|
||||
|
||||
componentDidMount() {
|
||||
const offset = (this._container.parentElement && this._container.parentElement.scrollTop) || 0;
|
||||
this.inst = new PerfectScrollbarConstructor(this._container, this.props.options || {});
|
||||
this._container.scrollTo(0, offset);
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
|
|
|
@ -21,6 +21,13 @@ export class MenuItem extends React.Component<MenuItemProps> {
|
|||
evt.stopPropagation();
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
const item = this.props.item;
|
||||
if (item.type !== 'group' && item.active) {
|
||||
this.scrollIntoView();
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
if (this.props.item.active) {
|
||||
this.scrollIntoView();
|
||||
|
|
Loading…
Reference in New Issue
Block a user