Fix Scroll to Left on When Element Inspected in Middle

Summary:
`scrollTo` used there caused the window to scroll to the most left when a user was inspecting an element which horizontal scroll wasn't in the most left position.

This diff removes the horizontal constrain and only scroll vertically.

Reviewed By: mweststrate

Differential Revision: D23284227

fbshipit-source-id: 7c19cac7496927c631572e222cb1d635dd1f8ea4
This commit is contained in:
Chaiwat Ekkaewnumchai
2020-08-24 03:33:44 -07:00
committed by Facebook GitHub Bot
parent f4c36377df
commit ecc3a280cf

View File

@@ -687,15 +687,14 @@ export class Elements extends PureComponent<ElementsProps, ElementsState> {
this.setState({scrolledElement: selected});
const outer = this._outerRef.current;
if (outer.scrollTo) {
outer.scrollTo(
0,
this._calculateScrollTop(
outer.scrollTo({
top: this._calculateScrollTop(
outer.offsetHeight,
outer.scrollTop,
selectedRow.offsetHeight,
selectedRow.offsetTop,
),
);
});
}
}
: null