From 41683013e373835fa27ab336aa78d36c40d39da5 Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 13 Jul 2026 11:19:10 +0800 Subject: [PATCH] fix: marketplace page header jitter when it in sticky status (#38832) --- .../plugins/marketplace/description/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web/app/components/plugins/marketplace/description/index.tsx b/web/app/components/plugins/marketplace/description/index.tsx index d2d5f8d50d1..c28d2b28ebd 100644 --- a/web/app/components/plugins/marketplace/description/index.tsx +++ b/web/app/components/plugins/marketplace/description/index.tsx @@ -101,6 +101,9 @@ const Description = ({ const header = headerRef.current if (!container || !header) return + const previousOverflowAnchor = container.style.overflowAnchor + container.style.overflowAnchor = 'none' + let maxHeaderHeight = 0 let lastAppliedOffset = 0 const updateOffset = () => { @@ -111,12 +114,8 @@ const Description = ({ const baseScrollableTop = Math.max(0, currentScrollableTop - lastAppliedOffset) const shouldCompensate = baseScrollableTop <= maxHeaderHeight const nextOffset = shouldCompensate ? collapsedHeight : 0 - const offsetDelta = nextOffset - lastAppliedOffset - if (nextOffset > 0) { container.style.setProperty('--marketplace-header-collapse-offset', `${nextOffset}px`) - if (offsetDelta !== 0 && container.scrollTop > 0) - container.scrollTop = Math.max(0, container.scrollTop + offsetDelta) } else { container.style.removeProperty('--marketplace-header-collapse-offset') } @@ -129,16 +128,17 @@ const Description = ({ if (typeof ResizeObserver === 'undefined') { return () => { container.style.removeProperty('--marketplace-header-collapse-offset') + container.style.overflowAnchor = previousOverflowAnchor } } const observer = new ResizeObserver(updateOffset) observer.observe(header) - observer.observe(container) return () => { observer.disconnect() container.style.removeProperty('--marketplace-header-collapse-offset') + container.style.overflowAnchor = previousOverflowAnchor } }, [isMarketplacePlatform, scrollContainerId])