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

PR comment link on viewed files not scrolling #23466

Closed
gempir opened this issue Mar 14, 2023 · 5 comments · Fixed by #23513
Closed

PR comment link on viewed files not scrolling #23466

gempir opened this issue Mar 14, 2023 · 5 comments · Fixed by #23513
Labels
topic/ui Change the appearance of the Gitea UI type/bug
Milestone

Comments

@gempir
Copy link
Contributor

gempir commented Mar 14, 2023

Description

When reviewing a file it is very common for the reviewer to mark these files as "viewed"
When you now get a link to a comment in a file you already viewed you can't properly open that link because the anchor tag is missing.

Steps to reproduce:

  1. Make a PR
  2. Add a comment
  3. Copy link of the comment (via the 3 dots menu)
  4. Mark the file as viewed
  5. Open the link

You will land at the top of the PR instead of at the comment.

My example:

https://try.gitea.io/gempir/gempbot/pulls/1/files#issuecomment-163257

First time you will land on the comment

Some comment on a file that is already marked as "viewed" for the user opening the link Previous Next

When you now mark that file as viewed you will not land on that comment anymore when you are opening the link above.
(See first screenshot)

Also minor nitpick: The Anchor lands directly on the text of the comment, not a little above, so it's very "cramped". (See second screenshot)

Gitea Version

1.20.0+dev-163-gd56bb7420

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

image

image

Git Version

No response

Operating System

No response

How are you running Gitea?

https://try.gitea.io/

Database

None

@yp05327
Copy link
Contributor

yp05327 commented Mar 15, 2023

It seems that the width of the window is related.

Browser: Chrome

  • Open a new tab

  • F12

  • set the window width: 700

  • access the example link
    image

  • Open a new tab

  • F12

  • set the window width: 950

  • access the example link
    image

  • Open a new tab

  • F12

  • set the window width: 1500

  • access the example link
    image

@lunny lunny added the topic/ui Change the appearance of the Gitea UI label Mar 15, 2023
@gempir
Copy link
Contributor Author

gempir commented Mar 15, 2023

I don't see the file marked as viewed in your screenshots. Can you reproduce this bug even with a wider width?

@HesterG
Copy link
Contributor

HesterG commented Mar 15, 2023

I think this can be improved to have the same behavior as github: scroll to the comment with the viewed file automatically expand when the hash from url hits the comment.

@yp05327
Copy link
Contributor

yp05327 commented Mar 16, 2023

I don't see the file marked as viewed in your screenshots. Can you reproduce this bug even with a wider width?

I did't login. So there was no viewed button.

@gempir
Copy link
Contributor Author

gempir commented Mar 16, 2023

I don't see the file marked as viewed in your screenshots. Can you reproduce this bug even with a wider width?

I did't login. So there was no viewed button.

That's my point. This issue exists only for logged in users. I'm not sure what you meant with the window width because in all your Screenshots the comment is visible.

@lunny lunny added this to the 1.19.0 milestone Mar 17, 2023
lunny pushed a commit that referenced this issue Mar 17, 2023
…and if file is folded, and on refreshing) (#23513)

Close #23466

Right now on pull request "files Changed" tab, if a file is viewed, when
the comments' links are visited, the comment will not be shown as the
file is folded after viewed. This PR is to improve the behavior, to make
the comment seen even the related file is folded, like on github.

And right now scroll position will be remembered and hence it won’t
scroll to hashed comment after refreshing, this PR also adjust the
scroll position remembering behavior: When there is hash comment in url,
do not remember the scroll position.

Before:

https://user-images.githubusercontent.com/17645053/225512079-6cf79581-9346-44cf-95d6-06919642e6a8.mov

After:

https://user-images.githubusercontent.com/17645053/225523753-3f6728f2-977b-4ed0-a65c-63dcef2ace80.mov

Update - long comment's behavior after using `scrollTop ` (Comment div
scroll to the position which is 30px below the diff header, or 30px
below top on conversation tab):

https://user-images.githubusercontent.com/17645053/225614460-0602c1a6-229c-41f4-84d2-334e78251486.mov
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Mar 17, 2023
…and if file is folded, and on refreshing) (go-gitea#23513)

Close go-gitea#23466

Right now on pull request "files Changed" tab, if a file is viewed, when
the comments' links are visited, the comment will not be shown as the
file is folded after viewed. This PR is to improve the behavior, to make
the comment seen even the related file is folded, like on github.

And right now scroll position will be remembered and hence it won’t
scroll to hashed comment after refreshing, this PR also adjust the
scroll position remembering behavior: When there is hash comment in url,
do not remember the scroll position.

Before:

https://user-images.githubusercontent.com/17645053/225512079-6cf79581-9346-44cf-95d6-06919642e6a8.mov

After:

https://user-images.githubusercontent.com/17645053/225523753-3f6728f2-977b-4ed0-a65c-63dcef2ace80.mov

Update - long comment's behavior after using `scrollTop ` (Comment div
scroll to the position which is 30px below the diff header, or 30px
below top on conversation tab):

https://user-images.githubusercontent.com/17645053/225614460-0602c1a6-229c-41f4-84d2-334e78251486.mov
techknowlogick pushed a commit that referenced this issue Mar 18, 2023
…and if file is folded, and on refreshing) (#23513) (#23540)

Backport #23513 by @HesterG

Close #23466
Right now on pull request "files Changed" tab, if a file is viewed, when
the comments' links are visited, the comment will not be shown as the
file is folded after viewed. This PR is to improve the behavior, to make
the comment seen even the related file is folded, like on github.

And right now scroll position will be remembered and hence it won’t
scroll to hashed comment after refreshing, this PR also adjust the
scroll position remembering behavior: When there is hash comment in url,
do not remember the scroll position.

Before:


https://user-images.githubusercontent.com/17645053/225512079-6cf79581-9346-44cf-95d6-06919642e6a8.mov


After:


https://user-images.githubusercontent.com/17645053/225523753-3f6728f2-977b-4ed0-a65c-63dcef2ace80.mov


Update - long comment's behavior after using `scrollTop ` (Comment div
scroll to the position which is 30px below the diff header, or 30px
below top on conversation tab):


https://user-images.githubusercontent.com/17645053/225614460-0602c1a6-229c-41f4-84d2-334e78251486.mov

Co-authored-by: Hester Gong <[email protected]>
@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
topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
4 participants