diff --git a/packages/code-studio/src/styleguide/SamplesMenu.tsx b/packages/code-studio/src/styleguide/SamplesMenu.tsx index cbee3c0eba..0e93b14a63 100644 --- a/packages/code-studio/src/styleguide/SamplesMenu.tsx +++ b/packages/code-studio/src/styleguide/SamplesMenu.tsx @@ -108,12 +108,19 @@ export function SamplesMenu(): JSX.Element { ? null : document.querySelector(window.location.hash); - if (el) { - // Give everything a chance to render before scrolling - setTimeout(() => { + // Give everything a chance to render before scrolling + setTimeout(() => { + if (el) { el.scrollIntoView(); - }, 0); - } + } else { + // NavTabList sample causes auto scrolling to middle of page, so we + // have to explicilty scroll back to the top of the page + window.scrollTo({ + top: 0, + behavior: 'auto', + }); + } + }, 0); }, []); const onAction = useCallback((key: Key) => { diff --git a/tests/styleguide.spec.ts-snapshots/chart-colors-chromium-linux.png b/tests/styleguide.spec.ts-snapshots/chart-colors-chromium-linux.png index 83f6a15ae5..2f0f718880 100644 Binary files a/tests/styleguide.spec.ts-snapshots/chart-colors-chromium-linux.png and b/tests/styleguide.spec.ts-snapshots/chart-colors-chromium-linux.png differ diff --git a/tests/styleguide.spec.ts-snapshots/chart-colors-firefox-linux.png b/tests/styleguide.spec.ts-snapshots/chart-colors-firefox-linux.png index 541fa63bfb..68a6a3811e 100644 Binary files a/tests/styleguide.spec.ts-snapshots/chart-colors-firefox-linux.png and b/tests/styleguide.spec.ts-snapshots/chart-colors-firefox-linux.png differ diff --git a/tests/styleguide.spec.ts-snapshots/chart-colors-webkit-linux.png b/tests/styleguide.spec.ts-snapshots/chart-colors-webkit-linux.png index 200c6f71f1..619ff78ff2 100644 Binary files a/tests/styleguide.spec.ts-snapshots/chart-colors-webkit-linux.png and b/tests/styleguide.spec.ts-snapshots/chart-colors-webkit-linux.png differ diff --git a/tests/styleguide.spec.ts-snapshots/charts-chromium-linux.png b/tests/styleguide.spec.ts-snapshots/charts-chromium-linux.png index 13dd039ada..921691db69 100644 Binary files a/tests/styleguide.spec.ts-snapshots/charts-chromium-linux.png and b/tests/styleguide.spec.ts-snapshots/charts-chromium-linux.png differ diff --git a/tests/styleguide.spec.ts-snapshots/charts-firefox-linux.png b/tests/styleguide.spec.ts-snapshots/charts-firefox-linux.png index 4fcb547bed..6e067fad33 100644 Binary files a/tests/styleguide.spec.ts-snapshots/charts-firefox-linux.png and b/tests/styleguide.spec.ts-snapshots/charts-firefox-linux.png differ diff --git a/tests/styleguide.spec.ts-snapshots/charts-webkit-linux.png b/tests/styleguide.spec.ts-snapshots/charts-webkit-linux.png index 9f297605b4..d835420114 100644 Binary files a/tests/styleguide.spec.ts-snapshots/charts-webkit-linux.png and b/tests/styleguide.spec.ts-snapshots/charts-webkit-linux.png differ