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

Fix alignment of truncated text in tables #25942

Closed
wants to merge 1 commit into from

Conversation

silverwind
Copy link
Member

Before:
Screenshot 2023-07-18 at 02 23 48

After:
image

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 18, 2023
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 18, 2023
@silverwind silverwind added the backport/v1.20 This PR should be backported to Gitea 1.20 label Jul 18, 2023
@wxiaoguang
Copy link
Contributor

I do not think this fix is right.

Because, the problem is caused by a pollution: <td class="text truncate email"> ...

Then, the <td> becomes display: inline-block, it would cause other side affects, because it should be a table-cell.

@delvh
Copy link
Member

delvh commented Jul 18, 2023

Am I supposed to not see any difference in the screenshots?

@wxiaoguang
Copy link
Contributor

Am I supposed to not see any difference in the screenshots?

There is slight difference for the "name: foo" and "version: 1.0.0", but, it's not an ideal fix (my comment above)

@silverwind
Copy link
Member Author

There's two kind of problems here:

  • td.text.truncate can be fixed with display: table-cell
  • td .text.truncate can not be fixed with display: table-cell as the nested inline-block still misaligns

Not sure how to proceed.

@silverwind
Copy link
Member Author

@wxiaoguang got any better solution ideas? I can't think of any and the current approach seems to reliably solve it.

@wxiaoguang
Copy link
Contributor

Will think about it in a few days .....

@silverwind
Copy link
Member Author

silverwind commented Jul 21, 2023

FWIW, vertical-align: bottom also fixes it and might be more intuitive because the text actually moves down. I don't understand the root cause yet. It's likely some obscure CSS rules related to tables.

@silverwind
Copy link
Member Author

Minimal Fiddle to show the issue: https://jsfiddle.net/silverwind/fs7ghbeq/

@wxiaoguang
Copy link
Contributor

I think we can drop the "text truncate" trick, and re-use the gt-ellipsis

Fix the truncate and alignment problem for some admin tables #26042

@silverwind
Copy link
Member Author

silverwind commented Jul 21, 2023

What does work is just not alter display:

https://jsfiddle.net/silverwind/fs7ghbeq/12/

@silverwind
Copy link
Member Author

I see your approach is exactly doing that. I think we can likely replace most if not all .text.truncate cases with gt-ellipsis.

@silverwind silverwind closed this Jul 21, 2023
@silverwind silverwind deleted the valigntable branch July 21, 2023 16:02
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Oct 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/v1.20 This PR should be backported to Gitea 1.20 lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants