From 04ad7236e4ff73c29643b7bef363b6c3a9b9daca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Fri, 15 May 2020 23:16:49 +0800 Subject: [PATCH] :bug: Fix Backtop cannot work in Chrome iframe (#24194) close #24192 --- components/_util/scrollTo.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/_util/scrollTo.ts b/components/_util/scrollTo.ts index 1c79cc93cbf1..b3648407d307 100644 --- a/components/_util/scrollTo.ts +++ b/components/_util/scrollTo.ts @@ -24,8 +24,8 @@ export default function scrollTo(y: number, options: ScrollToOptions = {}) { const nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration); if (isWindow(container)) { (container as Window).scrollTo(window.pageXOffset, nextScrollTop); - } else if (container instanceof Document) { - container.documentElement.scrollTop = nextScrollTop; + } else if (container instanceof HTMLDocument || container.constructor.name === 'HTMLDocument') { + (container as HTMLDocument).documentElement.scrollTop = nextScrollTop; } else { (container as HTMLElement).scrollTop = nextScrollTop; }