Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nav: browser back navigation does not jump to the correct position #509

Closed
nibau opened this issue Mar 30, 2023 · 1 comment
Closed

nav: browser back navigation does not jump to the correct position #509

nibau opened this issue Mar 30, 2023 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@nibau
Copy link

nibau commented Mar 30, 2023

This could be related to #476

I've recently noticed this issue with a markdown hugo page containing anchor links going to a different area within the same page.
e.g.

[SomeLink](#someheading)

...

## someheading

Let's say we have a page X with heading a.
When visiting X and clicking an anchor link #a the scroll position jumps to a.
When now using the browser back button, the expected native behavior is, that the scrolling position jumps back to the position it was before clicking the link. When clicking the browser forward button afterwards, the scrolling position should then jump back to the position it was before clicking the back button.

Example:

  1. Visit https://gohugo.io/hugo-modules/use-modules/#use-a-module-for-a-theme -> position jumps to "Use a Module for a Theme"
  2. Navigate/change URL to https://gohugo.io/hugo-modules/use-modules/#update-modules -> position jumps to "Update Modules"
  3. Click browser back button -> position jumps back to "Use a Module for a Theme"
  4. Click browser forward button -> scroll position back to "Update Modules"

When using the relearn theme I noticed that 3. and 4. do not seem to work properly, i.e. the scrolling position does not change when navigating back and forth between different anchors on the same page.

Example:

  1. Visit https://mcshelby.github.io/hugo-theme-relearn/basics/installation/
  2. Navigate/change URL to https://mcshelby.github.io/hugo-theme-relearn/basics/installation/#create-your-first-content-pages -> position jumps to "Create your first content pages"
  3. Try browser back button -> nothing happens

(I have tested with Firefox and Edge (Chromium))

@nibau nibau changed the title nav: browser back and forth navigation between different anchors on the same page does not scroll to the correct position nav: browser back and forth navigation between different anchors on the same page does not jump to the correct position Mar 30, 2023
@McShelby McShelby self-assigned this Mar 30, 2023
@McShelby McShelby added the bug Something isn't working label Mar 30, 2023
@McShelby McShelby changed the title nav: browser back and forth navigation between different anchors on the same page does not jump to the correct position nav: browser anchor back navigation does not jump to the correct position Mar 30, 2023
@McShelby
Copy link
Owner

I can confirm this but it will take a while to fix.

@McShelby McShelby added this to the 6.0.0 milestone Jun 6, 2023
@McShelby McShelby modified the milestones: 6.0.0, 5.26.0 Mar 14, 2024
@McShelby McShelby changed the title nav: browser anchor back navigation does not jump to the correct position nav: browser back navigation does not jump to the correct position Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants