From c2a488ca428fd6f793f6b90f7b9484cd3b62b815 Mon Sep 17 00:00:00 2001 From: Andy Robinson Date: Wed, 4 Nov 2020 17:44:02 +0100 Subject: [PATCH] Fix scroll position after following a link in wxHtmlWindow When not using an anchor, new page must be shown starting from its origin in the top-left corner, instead of remaining at the current scroll position, as it did before. Closes #18922. --- src/html/htmlwin.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index 7eb0d5650d..4f78084b83 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -627,6 +627,13 @@ bool wxHtmlWindow::LoadPage(const wxString& location) { ScrollToAnchor(f->GetAnchor()); } + else + { + // Without anchor, go to the top of the page, instead of + // possibly remaining at non-zero scroll position and scrolling + // the top out of view. + Scroll(0, 0); + } delete f;