Bug 382587 - Article viewer jumps to scroll position of previously viewed article
Summary: Article viewer jumps to scroll position of previously viewed article
Status: RESOLVED FIXED
Alias: None
Product: akregator
Classification: Applications
Component: general (show other bugs)
Version: 5.7.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 388690 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-07-22 12:27 UTC by Patrick
Modified: 2018-03-24 15:11 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick 2017-07-22 12:27:42 UTC
The article viewer seems to remember its scroll position and apply it to the next selected article. After reading a longer article in the article viewer and selecting a new article, you first have to scroll up to the top position to read the article from the beginning.

Akregator version 5.5.3.
Comment 1 Christophe Marin 2017-07-23 08:29:50 UTC
@Laurent this also happens with KMail.
Comment 2 Patrick 2017-09-16 08:57:05 UTC
I did some debugging and found that the scroll position is remembered by the chromium backend used by Qt. The scroll position restore used by akregator/messagelib isn't working because javascript is disabled. As enabling javascript might have side effects, a possible solution is loading a blank page before a new article is loaded in the viewer. You could do this in ArticleHtmlWebEngineWriter::begin() by replacing:
  mWebView->load(QUrl());
with
  mWebView->load(QUrl(QStringLiteral("about:blank")));
Comment 3 Laurent Montel 2017-09-16 09:16:43 UTC
(In reply to Patrick from comment #2)
> I did some debugging and found that the scroll position is remembered by the
> chromium backend used by Qt. The scroll position restore used by
> akregator/messagelib isn't working because javascript is disabled.

it's wrong as it's execute in specific environment.
js is enabled as private => it's execute for sure.

>
> As
> enabling javascript might have side effects, a possible solution is loading
> a blank page before a new article is loaded in the viewer. You could do this
> in ArticleHtmlWebEngineWriter::begin() by replacing:
>   mWebView->load(QUrl());
> with
>   mWebView->load(QUrl(QStringLiteral("about:blank")));

????
Comment 4 Patrick 2017-10-05 09:43:47 UTC
(In reply to Laurent Montel from comment #3)
> (In reply to Patrick from comment #2)
> > I did some debugging and found that the scroll position is remembered by the
> > chromium backend used by Qt. The scroll position restore used by
> > akregator/messagelib isn't working because javascript is disabled.
> 
> it's wrong as it's execute in specific environment.
> js is enabled as private => it's execute for sure.
> 
Javascript is enabled for external URLs, loaded in a new tab. But javascript is disabled for article content stored inside the feed, shown next to the article list (in widescreen view) or below the article list (in normal view). See the constructor of ArticleViewerWebEnginePage.


> >
> > As
> > enabling javascript might have side effects, a possible solution is loading
> > a blank page before a new article is loaded in the viewer. You could do this
> > in ArticleHtmlWebEngineWriter::begin() by replacing:
> >   mWebView->load(QUrl());
> > with
> >   mWebView->load(QUrl(QStringLiteral("about:blank")));
> 
> ????

The idea was to clear the page and reset the scroll position to the top, but it doesn't work well with the rest of the code.
Comment 5 Laurent Montel 2017-10-05 10:13:39 UTC
(In reply to Patrick from comment #4)
> (In reply to Laurent Montel from comment #3)
> > (In reply to Patrick from comment #2)
> > > I did some debugging and found that the scroll position is remembered by the
> > > chromium backend used by Qt. The scroll position restore used by
> > > akregator/messagelib isn't working because javascript is disabled.
> > 
> > it's wrong as it's execute in specific environment.
> > js is enabled as private => it's execute for sure.
> > 
> Javascript is enabled for external URLs, loaded in a new tab. But javascript
> is disabled for article content stored inside the feed, shown next to the
> article list (in widescreen view) or below the article list (in normal
> view). See the constructor of ArticleViewerWebEnginePage.

I know as I implemented it :)
but we can call javascript even if it's disabled it as we execute it in specific "room". For sure as it works as it in kmail (coded that I implemented too)

> 
> 
> > >
> > > As
> > > enabling javascript might have side effects, a possible solution is loading
> > > a blank page before a new article is loaded in the viewer. You could do this
> > > in ArticleHtmlWebEngineWriter::begin() by replacing:
> > >   mWebView->load(QUrl());
> > > with
> > >   mWebView->load(QUrl(QStringLiteral("about:blank")));
> > 
> > ????
> 
> The idea was to clear the page and reset the scroll position to the top, but
> it doesn't work well with the rest of the code.
Comment 6 Patrick 2017-10-05 12:27:16 UTC
To clarify my case, I'll add some steps to reproduce the problem:

1. Select an article in the article list. Make sure the article is long enough for the vertical scrollbar to appear in the article viewer.
2. In the article viewer, scroll down to the bottom of the article.
3. Select another article in the article list. Again, make sure the article is long enough for the vertical scrollbar to appear in the article viewer.

Notice the scroll position after step 3. It's not at the top where you would expect it to be.
Comment 7 Marc González Majoral 2017-10-24 15:29:44 UTC
I confirm this bug. Version 5.5.3 on Kubuntu.
Comment 8 Jonathan Marten 2018-01-17 20:04:16 UTC
*** Bug 388690 has been marked as a duplicate of this bug. ***
Comment 9 Jonathan Marten 2018-03-16 11:34:59 UTC
Fix as per comment#2 submitted by https://phabricator.kde.org/D11385
Comment 10 Jonathan Marten 2018-03-24 15:11:00 UTC
Git commit 84b4da183fb85c752cccf10a7b0378477ae5be44 by Jonathan Marten, on behalf of Patrick NoSurname.
Committed on 24/03/2018 at 15:10.
Pushed by marten into branch 'master'.

Article viewer: Reset scroll position when loading a new article

In theory this should not be necessary as the article is scrolled
to the top via JavaScript, but this does not appear to work in
some reported cases.

Differential Revision: https://phabricator.kde.org/D11385

M  +1    -1    src/articleviewer-ng/webengine/articlehtmlwebenginewriter.cpp

https://commits.kde.org/akregator/84b4da183fb85c752cccf10a7b0378477ae5be44