reg-viz/reg-suit

Disable smooth scrolling

stevschmid opened this issue · 1 comments

Is your feature request related to a problem? Please describe.

Smooth scrolling adds an annoying and unnecessary delay when dealing with hundreds of regression screenshots. Just take me directly to the screenshot I want to check out.

Describe the solution you'd like

Disable smooth scrolling in reg-cli-report-ui.

diff --git a/src/components/VGrid/VGrid.tsx b/src/components/VGrid/VGrid.tsx
index 5953c3a..8de2cc9 100644
--- a/src/components/VGrid/VGrid.tsx
+++ b/src/components/VGrid/VGrid.tsx
@@ -168,7 +168,7 @@ export class VGrid<T, K extends keyof T> extends React.Component<Props<T, K>, St
       if (hit) {
         // Notify scrolling to the context because we should not check the hash after the scrolling.
         this.context.consume();
-        setTimeout(() => this.scrollTo(hit.offsetIndex, true));
+        setTimeout(() => this.scrollTo(hit.offsetIndex));
       }
     }
   }
@@ -253,7 +253,7 @@ export class VGrid<T, K extends keyof T> extends React.Component<Props<T, K>, St
     this.updateCurrentOffsetIndex();
   }
 
-  private scrollTo(offsetIndex: number, instant = false) {
+  private scrollTo(offsetIndex: number) {
     const currentTop = scrollY;
     const top = this.calculateClientOffsetTop(offsetIndex);
     const threshold = this.state.visibleItemsLength * this.rowHeightUnit * 1;
@@ -271,7 +271,6 @@ export class VGrid<T, K extends keyof T> extends React.Component<Props<T, K>, St
     requestAnimationFrame(rafCb);
     scroll({
       top,
-      behavior: instant ? (('instant' as unknown) as any) : 'smooth',
     });
   }
 
diff --git a/src/styles/global-styles.ts b/src/styles/global-styles.ts
index c6d1fbd..57bc0bf 100644
--- a/src/styles/global-styles.ts
+++ b/src/styles/global-styles.ts
@@ -16,7 +16,6 @@ export const GlobalStyle = createGlobalStyle`
     -ms-text-size-adjust: 100%;
     font-family: ${FontFamily.SANS_SERIF};
     line-height: ${LineHeight.LARGE};
-    scroll-behavior: smooth;
     -webkit-font-smoothing: antialiased;
     -moz-osx-font-smoothing: grayscale;
   }

As you said, it’s not reg-suit issue but reg-cli-report-ui issue. Pls re-open at https://github.com/reg-viz/reg-cli-report-ui.