diff --git a/packages/website/src/components/NavbarMobile.astro b/packages/website/src/components/NavbarMobile.astro index 61733dcbf..7bb13b377 100644 --- a/packages/website/src/components/NavbarMobile.astro +++ b/packages/website/src/components/NavbarMobile.astro @@ -175,19 +175,26 @@ const strings = await api.strings(locale); const navbar = document.getElementById("navbar-mobile")!; const tool = document.getElementById("current-tool")!; const overlay = document.getElementById("navbar-mobile-overlay")!; - let lastScrollY = window.scrollY; + const lastScrollTops = new WeakMap(); - window.addEventListener( + // Scroll doesn't bubble, so capturing also catches nested scrollers like tables + document.addEventListener( "scroll", - () => { - const scrollY = window.scrollY; + (event) => { + const target = + event.target instanceof Element + ? event.target + : document.scrollingElement!; + const scrollTop = target.scrollTop; + const lastScrollTop = lastScrollTops.get(target) ?? 0; - if (scrollY === lastScrollY) return; + // Horizontal scrolling leaves scrollTop unchanged, so it's ignored + if (scrollTop === lastScrollTop) return; - navbar.dataset.visible = `${scrollY < lastScrollY}`; - lastScrollY = scrollY; + navbar.dataset.visible = `${scrollTop < lastScrollTop}`; + lastScrollTops.set(target, scrollTop); }, - { passive: true }, + { capture: true, passive: true }, ); tool.addEventListener("click", () => { diff --git a/packages/website/src/components/SystemTheme.astro b/packages/website/src/components/SystemTheme.astro index 7bab3accc..6e8cc8c94 100644 --- a/packages/website/src/components/SystemTheme.astro +++ b/packages/website/src/components/SystemTheme.astro @@ -1,12 +1,13 @@ diff --git a/packages/website/src/components/Table/index.tsx b/packages/website/src/components/Table/index.tsx index ed0e7dd34..9ac1d3678 100644 --- a/packages/website/src/components/Table/index.tsx +++ b/packages/website/src/components/Table/index.tsx @@ -42,7 +42,6 @@ function Root({ children, className, scrollable, ...props }: RootProps) { return () => observer.disconnect(); }, []); - const content = ( {children} diff --git a/packages/website/src/layouts/BaseLayout.astro b/packages/website/src/layouts/BaseLayout.astro index 9c36b91a3..037dc30f7 100644 --- a/packages/website/src/layouts/BaseLayout.astro +++ b/packages/website/src/layouts/BaseLayout.astro @@ -62,6 +62,7 @@ const tool = tools.tanks; .main { flex: 1; + min-width: 0; } @media screen and (max-width: 80rem) { diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/compare/_index.module.css b/packages/website/src/pages/[...chunk_default]/[...locale]/compare/_index.module.css index 6db9d1ae6..177e7e20a 100644 --- a/packages/website/src/pages/[...chunk_default]/[...locale]/compare/_index.module.css +++ b/packages/website/src/pages/[...chunk_default]/[...locale]/compare/_index.module.css @@ -17,8 +17,6 @@ } .table { - flex: 1; - min-height: 0; align-self: stretch; overflow: hidden;