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

Remove svg.svg class, restore .rss-icon #24667

Merged
merged 5 commits into from
May 12, 2023
Merged

Conversation

silverwind
Copy link
Member

Fix regression from #24476 where the svg.svg class misaligns SVG icons across the site and streched buttons unintentionally in vertical height.

Before (button 30.3px):
Screenshot 2023-05-11 at 22 09 42

After (button 30px):
Screenshot 2023-05-11 at 22 09 59

vertical-align: middle is not suitable to align icons to text because

Aligns the middle of the element with the baseline plus half the x-height of the parent.

Example of vertical-align: middle from MDN:

Screenshot 2023-05-11 at 22 29 28

So I think the existing vertical-align: text-top is generally still the best bet:

Screenshot 2023-05-11 at 22 34 24

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 11, 2023
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 11, 2023
@silverwind silverwind added type/bug topic/ui Change the appearance of the Gitea UI skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. labels May 11, 2023
@wxiaoguang
Copy link
Contributor

wxiaoguang commented May 12, 2023

Sorry I can't really see a different here.

Maybe it needs other fine tunes.

image

I would suggest to have a framework level solution for "button svg icon margin magic", instead of adding a lot of "gt-xxx", it doesn't look good to me.


So I think the existing vertical-align: text-top is generally still the best bet:

I guess that's because the icon height and line-height doesn't match? If we can give these icons proper height, no trick any more IMO?

Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't block it (and I admit that my approach is not good enough, and I missed another ".svg" class because it's in a separate file .... )

But I hope this is the last time for the "svg icon margin/align trick".

Really looking forward to a framework level clear solution.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 12, 2023
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 12, 2023
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 12, 2023
@silverwind
Copy link
Member Author

silverwind commented May 12, 2023

As I said, it's likely not possible to satisfy all cases with a "global" style. The only true vertical centering is align-content: center which only works in flexbox so is not applicable everywhere, and it does need to be on the parent.

*:has(.svg) { align-content: center } is the best I can think of, but it still needs the flex parent and I don't think :has selector can be made only match a direct child.

@silverwind silverwind enabled auto-merge (squash) May 12, 2023 07:56
@lunny lunny added this to the 1.20.0 milestone May 12, 2023
@silverwind silverwind merged commit a96c73f into go-gitea:main May 12, 2023
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 12, 2023
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Aug 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants