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

Make large code blocks and quotes scrollable #22260

Closed
wants to merge 1 commit into from
Closed

Make large code blocks and quotes scrollable #22260

wants to merge 1 commit into from

Conversation

Nightfirecat
Copy link

This commit introduces a max-height to both blockquote and preformatted elements along with automatic scroll behavior so that large blocks do not interrupt the visual flow of an issue thread. When nested within a details or another blockquote element, the max-height is unset as the parent element already has some control of the resulting height. (max-height applied by this commit for blockquotes, and collapsible contents for details)

This change is inspired by a similar change implemented in Refined Github years ago (the feature's current styles exist in a self-contained file today) which I've used and enjoyed for some time, and felt would be appreciated in Gitea as well. I chose 405px as the max-height value as it appears to result in the last line of text being partially cut off by the bottom of the container, helping to make clear visually that there is more text to be read upon scrolling.

Element Before (cropped to max. 1000px) After
<pre> Screen Shot 2022-12-28 at 06 03 12_vertical-crop Screenshot 2022-12-28 at 06-00-28 Add more vim defaults
<blockquote> Screenshot 2022-12-28 at 06-01-21 Add more vim defaults Screenshot 2022-12-28 at 06-00-35 Add more vim defaults

@lunny lunny added type/proposal The new feature has not been accepted yet but needs to be discussed first. topic/ui Change the appearance of the Gitea UI labels Dec 28, 2022
@lafriks
Copy link
Member

lafriks commented Dec 28, 2022

Imho this is very opinionated and personally I would not want that. That should be at least made as switchable option in top of markdown file (similarly how we have for diff, SVG files etc)

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 28, 2022
@Nightfirecat
Copy link
Author

I'm not opposed to that, however that would not help the issue of large code blocks in issue/PR comments breaking up the reading flow; there is no similar settings for how comments are displayed. I'd think this would be a good candidate for a user appearance setting, but there isn't currently any section which seems appropriate to put it under. (currently "Select default theme", "Language", and "Hidden comment types")

@lafriks
Copy link
Member

lafriks commented Dec 28, 2022

I would probably be ok if that would be only in comments but this will affect also markdown files

@KN4CK3R
Copy link
Member

KN4CK3R commented Dec 28, 2022

I like it in the editor preview but not in the real file.

This commit introduces a max-height to both blockquote and preformatted
elements along with automatic scroll behavior so that large blocks do
not interrupt the visual flow of an issue thread. When nested within a
details or another blockquote element, the max-height is unset as the
parent element already has some control of the resulting height.
(max-height applied by this commit for blockquotes, and collapsible
contents for details)
@Nightfirecat
Copy link
Author

I've pushed an update which should apply only to comments (ie. posts on issues and pull requests) and not to markdown files or to rendered READMEs

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (main@ca67c5a). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main   #22260   +/-   ##
=======================================
  Coverage        ?   47.83%           
=======================================
  Files           ?     1043           
  Lines           ?   142355           
  Branches        ?        0           
=======================================
  Hits            ?    68092           
  Misses          ?    66103           
  Partials        ?     8160           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@silverwind
Copy link
Member

I have a feeling this should either be made an option or be delegated completely to a user style. It should be trivial to have this added via Stylus for example.

It works for Refined GitHub because users can toggle every feature, but we don't really have the infrastructure yet in the Gitea UI to easily add such toggleable features (the prefs need to be stored server-side per-user).

@Nightfirecat
Copy link
Author

Hey, I wanted to follow up on this. What direction would the team like to see this taken? I'm happy to make further changes if this feature is something that's wanted in some capacity (behind an option toggle, or just added as a contrib/ userstyle entry), but I'm not really sure where to take it from here based on feedback so far.

@silverwind
Copy link
Member

Consensus seems to be that it's unwanted. Userstyle contrib isn't really something anyone would maintain, so the only way to get this is a default-off per-user option.

Adding an option blocked by us not having a proper UI for users where settings such as this one could be introduced. So if you also want to work on such an option UI, I could see a chance for it.

@Nightfirecat
Copy link
Author

I appreciate the follow-up. I don't presently have a development environment ready to commit to that work (and am likely lacking the skills to achieve such a feature anyway) so I have to pass on that. I'll close this PR since it doesn't have a path forward.

@Nightfirecat Nightfirecat deleted the scrollable-blocks branch March 19, 2023 02:00
@silverwind
Copy link
Member

You could always add this as custom CSS to your instance, or use a user style.

@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
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. topic/ui Change the appearance of the Gitea UI type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants