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

Anchors break after clicked once #21680

Closed
ell1e opened this issue Nov 4, 2022 · 4 comments · Fixed by #21931
Closed

Anchors break after clicked once #21680

ell1e opened this issue Nov 4, 2022 · 4 comments · Fixed by #21931
Labels

Comments

@ell1e
Copy link

ell1e commented Nov 4, 2022

Description

I noticed something which makes navigating documentation on gitea quite irritating: anchors break after clicked once. An anchor on every other page I've ever visited can be clicked multiple times in a row with scrolling in between, and every subsequent click will re-center the view to the anchor. Not when viewing a markdown file on Gitea however, only the first click works and then it just won't recenter anymore.

Try here by clicking the "Test anchor", then scrolling away with it still in view, then click it again (which should recenter the view once more and undo the scroll, but it doesn't): https://try.gitea.io/blablablablab/BlaTest/src/branch/main/README.md

Gitea Version

1.19.0+dev-39-g2900dc90a

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

Screencast.from.11-04-2022.12.52.41.PM.webm

Git Version

No response

Operating System

No response

How are you running Gitea?

I'm not, but this reproduces on all instances run by others that i have tested

Database

No response

@ell1e ell1e added the type/bug label Nov 4, 2022
@silverwind
Copy link
Member

Might be some JS interference, I'm not sure.

@apachejuice
Copy link

apachejuice commented Nov 4, 2022

This happens on the central gitea instance for me (https://gitea.com) but interestingly not my own at https://git.apachejuice.dev (for example in this page the anchors seem to work fine)
Specs of my gitea server:
grafik

Edited: lack of closing paren

@silverwind
Copy link
Member

silverwind commented Nov 4, 2022

I can reproduce on your instance as well:

  • Click anchor, page scrolls to it
  • Change scroll offset
  • Click same anchor again, page no longer scrolls to it

@apachejuice
Copy link

I did the exact same, although after reloading the page it appears too

silverwind added a commit to silverwind/gitea that referenced this issue Nov 24, 2022
The hashchange event did not fire on re-click of a active anchor.
Instead, use the click event.

Fixes: go-gitea#21680
lunny added a commit that referenced this issue Nov 26, 2022
The hashchange event did not fire on re-click of a active anchor.
Instead, use the click event which always fires.

Fixes: #21680

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
silverwind added a commit to silverwind/gitea that referenced this issue Nov 26, 2022
The hashchange event did not fire on re-click of a active anchor.
Instead, use the click event which always fires.

Fixes: go-gitea#21680

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
lunny added a commit that referenced this issue Nov 26, 2022
Backport #21931. The hashchange event did not fire on re-click of a
active anchor. Instead, use the click event which always fires.

Fixes: #21680

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants