-
-
Notifications
You must be signed in to change notification settings - Fork 50.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Backtop cannot work in Chrome iframe #24194
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add tests to make sure this change works as expected?
@@ -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') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chrome 下 element.ownerDocument instanceof HTMLDocument
是 false,比较奇怪。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report
@@ Coverage Diff @@
## master #24194 +/- ##
=======================================
Coverage 98.82% 98.82%
=======================================
Files 364 364
Lines 7291 7291
Branches 2019 1970 -49
=======================================
Hits 7205 7205
Misses 86 86
Continue to review full report at Codecov.
|
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
close #24192
💡 Background and solution
#22788 没有修干净,Chrome 下还是不能用。
📝 Changelog
☑️ Self Check before Merge