✓ Description of your issue
I’m designing a theme with frontity, I wanted a fixed header along with the fixed sidebar. I have successfully implemented it using CSS Grid but after implementing this window.scrollTo(0,0) stopped doing anything because everything was already in a fixed position because of the grid. I fixed it too by replacing window.scrollTo(0,0) with document.querySelector('[class*="ContentContainer"]').scrollTo(0,0) but now on hitting back button doesn’t remember the correct scroll position like it does everywhere for example, I want scrolling behaviour like Blog - Frontity.org. The behaviour I’m talking about is
- Open any page and scroll.
- Clicking on the internal link and scroll.
- Hit the browser back button, and your scroll position changes back to the original position.
I know it sounds confusing, please check this note with both videos and notice the arrow https://notes.divify.in/s/share/4957393/3qgk7phnzs9safmwlxic
✓ System info → npx frontity info
## System:
- OS: Windows 10 10.0.19042
- CPU: (8) x64 Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz
- Memory: 2.04 GB / 7.81 GB
## Binaries:
- Node: 14.15.1 - C:\Program Files\nodejs\node.EXE
- npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
## Browsers:
- Chrome: Not Found
- Edge: Spartan (44.19041.423.0), Chromium (87.0.664.47)
- Internet Explorer: 11.0.19041.1
## npmPackages:
- @frontity/core: ^1.9.1 => 1.9.0
- @frontity/google-analytics: ^1.3.1 => 1.3.1
- @frontity/head-tags: ^1.0.8 => 1.0.7 (1.0.8)
- @frontity/html2react: ^1.5.0 => 1.4.0 (1.5.0)
- @frontity/tiny-router: ^1.2.3 => 1.2.2
- @frontity/wp-comments: ^0.2.4 => 0.2.4
- @frontity/wp-source: ^1.10.0 => 1.9.1 (1.10.0)
- @frontity/yoast: ^2.0.1 => 2.0.1
- forgotten-developer: file:packages/forgotten-developer => 1.0.0
- frontity: ^1.13.0 => 1.12.0 (1.13.0)
- prismjs: ^1.22.0 => 1.22.0
- react-icons: ^3.11.0 => 3.11.0
- yarn: ^1.22.10 => 1.22.10
## npmGlobalPackages:
- frontity: Not Found
- npx: Not Found
✓ Specific errors you’re getting in the terminal
None
✓ Specific errors getting in the console when open category link from the navigation menu
None
✓ A repository or code sandbox with the code of your project
https://github.com/Divaksh/forgotten-developer/tree/master
✓ A deployed version of your site
http://divaksh.com/
✓ The URL of your WP REST API
https://api.divaksh.com/wp-json
But I found a way to send scroll to the top. I can do this by using onpopstate but is it good idea to use the following code? If yes then what is the best place to use the code in the theme?