@samitouri / QOS-React-2 / commits / 9162b7165a

Prefer to keep the start anchor visible

Dan committed Apr 13, 2019 at 16:49 UTC 9162b7165ad446cf12cea88eecf94f2787de6e75
1 file changed +6 -4
src/devtools/views/Components/Element.js
+6 -4
@@ -80,15 +80,17 @@ export default function ElementView({ data, index, style }: Props) {
80 // However, even calling scrollIntoView() on their parent node
81 // wouldn't guarantee that it will be *fully* brought into view.
82 // As a workaround, we'll have two anchor spans, and scroll each into view.
83 - if (scrollAnchorStartRef.current !== null) {
84 - scrollAnchorStartRef.current.scrollIntoView({
83 + if (scrollAnchorEndRef.current !== null) {
84 + scrollAnchorEndRef.current.scrollIntoView({
85 behavior: 'auto',
86 block: 'nearest',
87 inline: 'nearest',
88 });
89 }
90 - if (scrollAnchorEndRef.current !== null) {
91 - scrollAnchorEndRef.current.scrollIntoView({
90 + if (scrollAnchorStartRef.current !== null) {
91 + // We scroll the start anchor last because it's
92 + // more important for it to be in the view.
93 + scrollAnchorStartRef.current.scrollIntoView({
94 behavior: 'auto',
95 block: 'nearest',
96 inline: 'nearest',