Get the y scroll position in the detail view using window.pageYOffset instead of document.body.scrollTop. It appears the latter may be broken — at any rate, it just returns 0 on Catalina. (On Mojave, use the same method as before, so as not to risk a regression.)
This commit is contained in:
parent
56fab24cec
commit
a11e900a93
|
@ -186,7 +186,10 @@ private extension DetailWebViewController {
|
|||
}
|
||||
|
||||
func fetchScrollInfo(_ callback: @escaping (ScrollInfo?) -> Void) {
|
||||
let javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: document.body.scrollTop}; x"
|
||||
var javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: document.body.scrollTop}; x"
|
||||
if #available(macOS 10.15, *) {
|
||||
javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: window.pageYOffset}; x"
|
||||
}
|
||||
|
||||
webView.evaluateJavaScript(javascriptString) { (info, error) in
|
||||
guard let info = info as? [String: Any] else {
|
||||
|
|
Loading…
Reference in New Issue