Skip to content

Commit 3e2bba0

Browse files
parnicsilverwind6543lunny
authored
Fix Pull Request comment filename word breaks (#19535)
* Fix word breaks in Chrome This fixes word wrapping on the filename for a comment on a PR. A previous commit fixed this problem in Firefox, but not Chrome. Fixes #16248 * Don't break Outdated badge This prevents the Outdated badge on a PR from wrapping in the middle of the word for a comment on a long filename. * Move word break to recommended element * Add overflow-wrap per PR review * Update web_src/less/helpers.less Co-authored-by: silverwind <[email protected]> Co-authored-by: 6543 <[email protected]> Co-authored-by: Lunny Xiao <[email protected]>
1 parent 334707f commit 3e2bba0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

templates/repo/issue/view_content/comments.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,13 +505,13 @@
505505
{{ range $filename, $lines := .Review.CodeComments}}
506506
{{range $line, $comms := $lines}}
507507
<div class="ui segments">
508-
<div class="ui segment py-3 df ac sb word-break">
508+
<div class="ui segment py-3 df ac sb">
509509
{{$invalid := (index $comms 0).Invalidated}}
510510
{{$resolved := (index $comms 0).IsResolved}}
511511
{{$resolveDoer := (index $comms 0).ResolveDoer}}
512512
{{$isNotPending := (not (eq (index $comms 0).Review.Type 0))}}
513513
<div class="df ac">
514-
<a href="{{(index $comms 0).CodeCommentURL}}" class="file-comment ml-3">{{$filename}}</a>
514+
<a href="{{(index $comms 0).CodeCommentURL}}" class="file-comment ml-3 word-break">{{$filename}}</a>
515515
{{if $invalid }}
516516
<span class="ui label basic small ml-3">
517517
{{$.i18n.Tr "repo.issues.review.outdated"}}

web_src/less/helpers.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727

2828
.word-break {
2929
word-wrap: break-word !important;
30+
word-break: break-word; /* compat: Safari */
31+
overflow-wrap: anywhere;
3032
}
3133

3234
.ellipsis {

0 commit comments

Comments
 (0)