{"action":"created","issue":{"url":"https://api.github.com/repos/swup/swup/issues/185","repository_url":"https://api.github.com/repos/swup/swup","labels_url":"https://api.github.com/repos/swup/swup/issues/185/labels{/name}","comments_url":"https://api.github.com/repos/swup/swup/issues/185/comments","events_url":"https://api.github.com/repos/swup/swup/issues/185/events","html_url":"https://github.com/swup/swup/issues/185","id":478356856,"node_id":"MDU6SXNzdWU0NzgzNTY4NTY=","number":185,"title":"Keep the scroll position with back button / browsing back","user":{"login":"tahola","id":1329725,"node_id":"MDQ6VXNlcjEzMjk3MjU=","avatar_url":"https://avatars0.githubusercontent.com/u/1329725?v=4","gravatar_id":"","url":"https://api.github.com/users/tahola","html_url":"https://github.com/tahola","followers_url":"https://api.github.com/users/tahola/followers","following_url":"https://api.github.com/users/tahola/following{/other_user}","gists_url":"https://api.github.com/users/tahola/gists{/gist_id}","starred_url":"https://api.github.com/users/tahola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tahola/subscriptions","organizations_url":"https://api.github.com/users/tahola/orgs","repos_url":"https://api.github.com/users/tahola/repos","events_url":"https://api.github.com/users/tahola/events{/privacy}","received_events_url":"https://api.github.com/users/tahola/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2019-08-08T09:34:58Z","updated_at":"2019-09-14T12:57:40Z","closed_at":"2019-09-14T12:57:40Z","author_association":"NONE","body":"Hello, when I click a link in the bottom of a page I will be on the bottom of the next page, I fixed that with the scroll plugin but when when I go back, the scroll position is allways the top of the page, so in the both case Swup is doing the opposite of what I want, I am doing something wrong ? \r\n\r\nHere is my config :\r\n\r\n```javascript\r\nconst options = {\r\n\tplugins: [\r\n\t\tnew SwupScriptsPlugin({\r\n\t\t\thead: false,\r\n\t\t\tbody: false\r\n\t\t}),\r\n\t\tnew SwupScrollPlugin({\r\n\t\t\tdoScrollingRightAway: true,\r\n\t\t\tanimateScroll: true,\r\n\t\t}),\r\n\t\tnew SwupPreloadPlugin(),\r\n\t\tnew SwupDebugPlugin(),\r\n\t],\r\n\tanimateHistoryBrowsing: false,\r\n\tanimationSelector: '[class*=\"transition-\"]',\r\n\tcontainers: [\"#swup\"],\r\n\tcache: false,\r\n\tlinkSelector:\r\n\t'a[href^=\"' +\r\n\twindow.location.origin +\r\n\t'\"]:not([data-no-swup]), a[href^=\"/\"]:not([data-no-swup]), a[href^=\"#\"]:not([data-no-swup])',\r\n\tskipPopStateHandling: function(event) {\r\n\tif (event.state && event.state.source == \"swup\") {\r\n\t \treturn false;\r\n\t}\r\n\t\treturn true;\r\n\t}\r\n};\r\n\r\nconst swup = new Swup(options);\r\n```"},"comment":{"url":"https://api.github.com/repos/swup/swup/issues/comments/531477824","html_url":"https://github.com/swup/swup/issues/185#issuecomment-531477824","issue_url":"https://api.github.com/repos/swup/swup/issues/185","id":531477824,"node_id":"MDEyOklzc3VlQ29tbWVudDUzMTQ3NzgyNA==","user":{"login":"gmrchk","id":9338324,"node_id":"MDQ6VXNlcjkzMzgzMjQ=","avatar_url":"https://avatars3.githubusercontent.com/u/9338324?v=4","gravatar_id":"","url":"https://api.github.com/users/gmrchk","html_url":"https://github.com/gmrchk","followers_url":"https://api.github.com/users/gmrchk/followers","following_url":"https://api.github.com/users/gmrchk/following{/other_user}","gists_url":"https://api.github.com/users/gmrchk/gists{/gist_id}","starred_url":"https://api.github.com/users/gmrchk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmrchk/subscriptions","organizations_url":"https://api.github.com/users/gmrchk/orgs","repos_url":"https://api.github.com/users/gmrchk/repos","events_url":"https://api.github.com/users/gmrchk/events{/privacy}","received_events_url":"https://api.github.com/users/gmrchk/received_events","type":"User","site_admin":false},"created_at":"2019-09-14T12:57:40Z","updated_at":"2019-09-14T12:57:40Z","author_association":"MEMBER","body":"Hi guys,\r\n\r\nThank you for your input @aerni. This code is actually only needed for stuff like a bug in Firefox (Chrome or Edge works correctly from what I know), which sets the scroll position before replacing content, so it causes the page to be in a wrong position after back/forward, as pages can have different heights. \r\n\r\n@tahola what scroll plugin does is that it scrolls to the top (or anchor element) after content replace. On back/forward, scroll plugin leaves the setting of the scroll to the browser, which will process it based on the popstate event. \r\n\r\nIs it possible that your page styles will cause the page to reset scroll? Something like `overflow: hidden` on the body element and `overflow: scroll` on some child wrapper element, which is replaced by swup, or something like that? \r\n\r\nAnyways, sorry to see you go."}}
{"actor":{"display_login":"gmrchk"}}