Compare commits

...

5 Commits

Author SHA1 Message Date
Yarden Shoham
ddf61373f6
Add wrapper to author to avoid long name ui problem (#23030) (#23098)
Backport #23030

This PR is a possible solution for issue #22866. Main change is to add a
`author-wrapper` class around author name, like the wrapper added to
message. The `max-width` is set to 200px on PC, and 100px on mobile
device for now. Which will work like below:

<img width="1183" alt="2023-02-21 11 57 53"
src="https://user-images.githubusercontent.com/17645053/220244146-3d47c512-33b6-4ed8-938e-de0a8bc26ffb.png">

<img width="417" alt="2023-02-21 11 58 43"
src="https://user-images.githubusercontent.com/17645053/220244154-1ea0476b-9d1c-473a-9917-d3216860f9a9.png">

And `title` is added to the wrapper like it did in message wrapper. So
the full author name will show on hover.

Co-authored-by: HesterG <hestergong@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-02-24 10:45:18 +08:00
Yarden Shoham
b4ed3f07e4
Fix commit name in Apply Patch page (#23086) (#23099)
Backport #23086

Fixes
https://github.com/go-gitea/gitea/issues/22621#issuecomment-1439309200

Co-authored-by: yp05327 <576951401@qq.com>
2023-02-24 08:47:35 +08:00
HesterG
ced94f2e0d
Add accessibility to the menu on the navbar (#23059) (#23095)
Backport #23059

This PR is trying to add accessibility to the menu as mentioned in
#23053 so the menu can be accessed using keyboard (A quick demo is added
below), with a reference to
[PR2612](https://github.com/go-gitea/gitea/pull/22612). The goal is to
make the menu accessible merely using keyboard like shown below. And
this PR might need confirmation from developers using screen readers.
2023-02-23 20:56:03 +08:00
Yarden Shoham
aff432b197
Nest metadata in refactoring docs (#23087) (#23091)
Backport #23087

Whitespace was missing from refactoring docs metadata.

backport label applied so it is included in versioned docs.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2023-02-23 03:39:30 -05:00
Yarden Shoham
0ac3be1482
Improve accessibility for issue comments (#22612) (#23083)
Backport #22612

### Preamble

Gitea is an extremely great and smart solution perfectly suitable for
smaller systems and self-hosted Git-powered setups. However, there is a
group of people who have indredible difficulties in using Gitea,
rendering it useless in many cases. Those people are blind developers
using [screen readers](https://en.wikipedia.org/wiki/Screen_reader).
Unfortunately, the frontend framework is super convoluted, and Go
templates don’t allow accessibility improvements in a straightforward
way. As a blind developer myself, I'm trying to start fixing smaller
accessibility quirks with intention to go deeper and eventually, alone
or not, make Gitea at least mostly accessible for screen reader users.

### What This Fix Does

My blind fellows and me navigate webpages not very similarly to how a
sighted person does it. For instance, we love semantic HTML markup like
headings, lists, tables etc. because our screen readers allow us to jump
by those landmarks with a single keypress.
Currently in Gitea issue comments are not marked up with headings. I'm
trying to fix this by adding an appropriate
[ARIA](https://www.w3.org/WAI/standards-guidelines/aria/) role for
comment header and also by enclosing the comment itself in a semantical
article element.

Co-authored-by: Andre Polykanine <ap@oire.me>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-02-23 16:32:15 +08:00
8 changed files with 35 additions and 21 deletions

View File

@ -6,11 +6,11 @@ weight: 20
toc: false toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
parent: "developers" parent: "developers"
name: "Guidelines for Refactoring" name: "Guidelines for Refactoring"
weight: 20 weight: 20
identifier: "guidelines-refactoring" identifier: "guidelines-refactoring"
--- ---
# Guidelines for Refactoring # Guidelines for Refactoring

View File

@ -25,6 +25,8 @@ const (
func NewDiffPatch(ctx *context.Context) { func NewDiffPatch(ctx *context.Context) {
canCommit := renderCommitRights(ctx) canCommit := renderCommitRights(ctx)
ctx.Data["PageIsPatch"] = true
ctx.Data["TreePath"] = "" ctx.Data["TreePath"] = ""
ctx.Data["commit_summary"] = "" ctx.Data["commit_summary"] = ""
@ -51,6 +53,7 @@ func NewDiffPatchPost(ctx *context.Context) {
if form.CommitChoice == frmCommitChoiceNewBranch { if form.CommitChoice == frmCommitChoiceNewBranch {
branchName = form.NewBranchName branchName = form.NewBranchName
} }
ctx.Data["PageIsPatch"] = true
ctx.Data["TreePath"] = "" ctx.Data["TreePath"] = ""
ctx.Data["BranchLink"] = ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL() ctx.Data["BranchLink"] = ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL()
ctx.Data["FileContent"] = form.Content ctx.Data["FileContent"] = form.Content

View File

@ -18,9 +18,9 @@
</span> </span>
</a> </a>
{{end}} {{end}}
<div class="ui icon button mobile-only" id="navbar-expand-toggle"> <button class="ui icon button mobile-only" id="navbar-expand-toggle">
{{svg "octicon-three-bars"}} {{svg "octicon-three-bars"}}
</div> </button>
</div> </div>
</div> </div>

View File

@ -9,7 +9,7 @@
{{.locale.Tr "repo.editor.commit_changes"}} {{.locale.Tr "repo.editor.commit_changes"}}
{{- end}}</h3> {{- end}}</h3>
<div class="field"> <div class="field">
<input name="commit_summary" placeholder="{{if .PageIsDelete}}{{.locale.Tr "repo.editor.delete" .TreePath}}{{else if .PageIsUpload}}{{.locale.Tr "repo.editor.upload_files_to_dir" .TreePath}}{{else if .IsNewFile}}{{.locale.Tr "repo.editor.add_tmpl"}}{{else}}{{.locale.Tr "repo.editor.update" .TreePath}}{{end}}" value="{{.commit_summary}}" autofocus> <input name="commit_summary" placeholder="{{if .PageIsDelete}}{{.locale.Tr "repo.editor.delete" .TreePath}}{{else if .PageIsUpload}}{{.locale.Tr "repo.editor.upload_files_to_dir" .TreePath}}{{else if .IsNewFile}}{{.locale.Tr "repo.editor.add_tmpl"}}{{else if .PageIsPatch}}{{.locale.Tr "repo.editor.patch"}}{{else}}{{.locale.Tr "repo.editor.update" .TreePath}}{{end}}" value="{{.commit_summary}}" autofocus>
</div> </div>
<div class="field"> <div class="field">
<textarea name="commit_message" placeholder="{{.locale.Tr "repo.editor.commit_message_desc"}}" rows="5">{{.commit_message}}</textarea> <textarea name="commit_message" placeholder="{{.locale.Tr "repo.editor.commit_message_desc"}}" rows="5">{{.commit_message}}</textarea>

View File

@ -27,7 +27,7 @@
</a> </a>
{{end}} {{end}}
<div class="content comment-container"> <div class="content comment-container">
<div class="ui top attached header comment-header gt-df gt-ac gt-sb"> <div class="ui top attached header comment-header gt-df gt-ac gt-sb" role="heading" aria-level="3">
<div class="comment-header-left gt-df gt-ac"> <div class="comment-header-left gt-df gt-ac">
{{if .Issue.OriginalAuthor}} {{if .Issue.OriginalAuthor}}
<span class="text black gt-bold"> <span class="text black gt-bold">
@ -69,7 +69,7 @@
{{end}} {{end}}
</div> </div>
</div> </div>
<div class="ui attached segment comment-body"> <div class="ui attached segment comment-body" role="article">
<div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission $.IsIssuePoster}}data-can-edit="true"{{end}}> <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission $.IsIssuePoster}}data-can-edit="true"{{end}}>
{{if .Issue.RenderedContent}} {{if .Issue.RenderedContent}}
{{.Issue.RenderedContent|Str2html}} {{.Issue.RenderedContent|Str2html}}
@ -85,7 +85,7 @@
</div> </div>
{{$reactions := .Issue.Reactions.GroupByType}} {{$reactions := .Issue.Reactions.GroupByType}}
{{if $reactions}} {{if $reactions}}
<div class="ui attached segment reactions"> <div class="ui attached segment reactions" role="note">
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}} {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}}
</div> </div>
{{end}} {{end}}

View File

@ -22,7 +22,7 @@
</a> </a>
{{end}} {{end}}
<div class="content comment-container"> <div class="content comment-container">
<div class="ui top attached header comment-header gt-df gt-ac gt-sb"> <div class="ui top attached header comment-header gt-df gt-ac gt-sb" role="heading" aria-level="3">
<div class="comment-header-left gt-df gt-ac"> <div class="comment-header-left gt-df gt-ac">
{{if .OriginalAuthor}} {{if .OriginalAuthor}}
<span class="text black gt-bold gt-mr-2"> <span class="text black gt-bold gt-mr-2">
@ -69,7 +69,7 @@
{{end}} {{end}}
</div> </div>
</div> </div>
<div class="ui attached segment comment-body"> <div class="ui attached segment comment-body" role="article">
<div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}> <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}>
{{if .RenderedContent}} {{if .RenderedContent}}
{{.RenderedContent|Str2html}} {{.RenderedContent|Str2html}}
@ -85,7 +85,7 @@
</div> </div>
{{$reactions := .Reactions.GroupByType}} {{$reactions := .Reactions.GroupByType}}
{{if $reactions}} {{if $reactions}}
<div class="ui attached segment reactions"> <div class="ui attached segment reactions" role="note">
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
</div> </div>
{{end}} {{end}}

View File

@ -8,14 +8,14 @@
{{if .LatestCommitUser}} {{if .LatestCommitUser}}
{{avatar $.Context .LatestCommitUser 24}} {{avatar $.Context .LatestCommitUser 24}}
{{if .LatestCommitUser.FullName}} {{if .LatestCommitUser.FullName}}
<a class="muted" href="{{.LatestCommitUser.HomeLink}}"><strong>{{.LatestCommitUser.FullName}}</strong></a> <a class="muted author-wrapper" title="{{.LatestCommitUser.FullName}}" href="{{.LatestCommitUser.HomeLink}}"><strong>{{.LatestCommitUser.FullName}}</strong></a>
{{else}} {{else}}
<a class="muted" href="{{.LatestCommitUser.HomeLink}}"><strong>{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}</strong></a> <a class="muted author-wrapper" title="{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}" href="{{.LatestCommitUser.HomeLink}}"><strong>{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}</strong></a>
{{end}} {{end}}
{{else}} {{else}}
{{if .LatestCommit.Author}} {{if .LatestCommit.Author}}
{{avatarByEmail $.Context .LatestCommit.Author.Email .LatestCommit.Author.Name 24}} {{avatarByEmail $.Context .LatestCommit.Author.Email .LatestCommit.Author.Name 24}}
<strong>{{.LatestCommit.Author.Name}}</strong> <span class="author-wrapper" title="{{.LatestCommit.Author.Name}}"><strong>{{.LatestCommit.Author.Name}}</strong></span>
{{end}} {{end}}
{{end}} {{end}}
<a rel="nofollow" class="ui sha label {{if .LatestCommit.Signature}} isSigned {{if .LatestCommitVerification.Verified}} isVerified{{if eq .LatestCommitVerification.TrustStatus "trusted"}}{{else if eq .LatestCommitVerification.TrustStatus "untrusted"}}Untrusted{{else}}Unmatched{{end}}{{else if .LatestCommitVerification.Warning}} isWarning{{end}}{{end}}" href="{{.RepoLink}}/commit/{{PathEscape .LatestCommit.ID.String}}"> <a rel="nofollow" class="ui sha label {{if .LatestCommit.Signature}} isSigned {{if .LatestCommitVerification.Verified}} isVerified{{if eq .LatestCommitVerification.TrustStatus "trusted"}}{{else if eq .LatestCommitVerification.TrustStatus "untrusted"}}Untrusted{{else}}Unmatched{{end}}{{else if .LatestCommitVerification.Warning}} isWarning{{end}}{{end}}" href="{{.RepoLink}}/commit/{{PathEscape .LatestCommit.ID.String}}">

View File

@ -237,6 +237,8 @@
} }
#repo-files-table { #repo-files-table {
table-layout: fixed;
thead { thead {
th { th {
padding-top: 8px; padding-top: 8px;
@ -2885,7 +2887,8 @@ tbody.commit-list {
vertical-align: baseline; vertical-align: baseline;
} }
.message-wrapper { .message-wrapper,
.author-wrapper {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: calc(100% - 50px); max-width: calc(100% - 50px);
@ -2893,6 +2896,10 @@ tbody.commit-list {
vertical-align: middle; vertical-align: middle;
} }
.author-wrapper {
max-width: 180px;
}
// in the commit list, messages can wrap so we can use inline // in the commit list, messages can wrap so we can use inline
.commit-list .message-wrapper { .commit-list .message-wrapper {
display: inline; display: inline;
@ -2912,6 +2919,10 @@ tbody.commit-list {
display: block; display: block;
max-width: calc(100vw - 70px); max-width: calc(100vw - 70px);
} }
.author-wrapper {
max-width: 80px;
}
} }
@media @mediaMd { @media @mediaMd {
@ -2920,7 +2931,7 @@ tbody.commit-list {
} }
th .message-wrapper { th .message-wrapper {
max-width: 280px; max-width: 120px;
} }
} }
@ -2930,7 +2941,7 @@ tbody.commit-list {
} }
th .message-wrapper { th .message-wrapper {
max-width: 490px; max-width: 350px;
} }
} }
@ -2940,7 +2951,7 @@ tbody.commit-list {
} }
th .message-wrapper { th .message-wrapper {
max-width: 680px; max-width: 525px;
} }
} }