{"action":"created","issue":{"url":"https://api.github.com/repos/turbolinks/turbolinks/issues/420","repository_url":"https://api.github.com/repos/turbolinks/turbolinks","labels_url":"https://api.github.com/repos/turbolinks/turbolinks/issues/420/labels{/name}","comments_url":"https://api.github.com/repos/turbolinks/turbolinks/issues/420/comments","events_url":"https://api.github.com/repos/turbolinks/turbolinks/issues/420/events","html_url":"https://github.com/turbolinks/turbolinks/pull/420","id":364982945,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5MDQwNTgw","number":420,"title":"Fix Scrolling Issues","user":{"login":"domchristie","id":111734,"node_id":"MDQ6VXNlcjExMTczNA==","avatar_url":"https://avatars0.githubusercontent.com/u/111734?v=4","gravatar_id":"","url":"https://api.github.com/users/domchristie","html_url":"https://github.com/domchristie","followers_url":"https://api.github.com/users/domchristie/followers","following_url":"https://api.github.com/users/domchristie/following{/other_user}","gists_url":"https://api.github.com/users/domchristie/gists{/gist_id}","starred_url":"https://api.github.com/users/domchristie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domchristie/subscriptions","organizations_url":"https://api.github.com/users/domchristie/orgs","repos_url":"https://api.github.com/users/domchristie/repos","events_url":"https://api.github.com/users/domchristie/events{/privacy}","received_events_url":"https://api.github.com/users/domchristie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-28T17:48:56Z","updated_at":"2018-10-16T22:36:28Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/turbolinks/turbolinks/pulls/420","html_url":"https://github.com/turbolinks/turbolinks/pull/420","diff_url":"https://github.com/turbolinks/turbolinks/pull/420.diff","patch_url":"https://github.com/turbolinks/turbolinks/pull/420.patch"},"body":"This is an attempt at fixing #181 and #241.\r\n\r\nWhen a page is invalidated, either by tracked asset changes or via the `turbolinks-visit-control` directive, it is reloaded but the user is returned to the previous scroll position :/ This can be jarring when moving between long pages with different layouts—someone will click a link and be dumped some way down the page when it loads. This is discussed in #181, and I have outlined a couple of solutions in https://github.com/turbolinks/turbolinks/issues/181#issuecomment-423448708. This pull request aims to implement the \"improved solution\" in a more structured way.\r\n\r\nFirst, we set the `scrollRestoration` flag to `manual` to indicate to the browser that we'll be handling scroll positions when navigating via the history. This seemingly impacts the scroll position on reload, too. It's great for this bug as it means that if a page is invalidated and reloaded, we do nothing. However, we also don't want to break the refresh button :/ So to fix this we store the scroll position in session storage, and restore it on reload.\r\n\r\nConfiguring `scrollRestoration` has the nice side-effect of fixing scrolling flicker when navigation Back/Forward #241. The downside is that for a complete solution we need to persist scroll values across full page loads (on `beforeunload`), through session storage, which I'm not 100% convinced about.\r\n\r\n---\r\n\r\n`scrollRestoration` is not supported in IE/Edge, so I would welcome some testers in those browsers in particular. ~Also, I should add some automated tests for this, but I'm having some difficulty in setting up the recent test framework. (I think Intern starts the server then immediately stops with no error.)~ Thanks to @jason0x43 for his help on this. My old version of Java was not compatible with Intern."},"comment":{"url":"https://api.github.com/repos/turbolinks/turbolinks/issues/comments/430425225","html_url":"https://github.com/turbolinks/turbolinks/pull/420#issuecomment-430425225","issue_url":"https://api.github.com/repos/turbolinks/turbolinks/issues/420","id":430425225,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMDQyNTIyNQ==","user":{"login":"kinduff","id":1270156,"node_id":"MDQ6VXNlcjEyNzAxNTY=","avatar_url":"https://avatars0.githubusercontent.com/u/1270156?v=4","gravatar_id":"","url":"https://api.github.com/users/kinduff","html_url":"https://github.com/kinduff","followers_url":"https://api.github.com/users/kinduff/followers","following_url":"https://api.github.com/users/kinduff/following{/other_user}","gists_url":"https://api.github.com/users/kinduff/gists{/gist_id}","starred_url":"https://api.github.com/users/kinduff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinduff/subscriptions","organizations_url":"https://api.github.com/users/kinduff/orgs","repos_url":"https://api.github.com/users/kinduff/repos","events_url":"https://api.github.com/users/kinduff/events{/privacy}","received_events_url":"https://api.github.com/users/kinduff/received_events","type":"User","site_admin":false},"created_at":"2018-10-16T22:36:28Z","updated_at":"2018-10-16T22:36:28Z","author_association":"NONE","body":"Love this. Please merge :+1: "}}
{"actor":{"display_login":"kinduff"}}