diff options
author | delvh <dev.lh@web.de> | 2023-05-21 22:47:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-21 20:47:41 +0000 |
commit | e95b42e187cde9ac4bd541cd714bdb4f5c1fd8bc (patch) | |
tree | 473584ab54af5220390413f2199843597f2be5f2 /templates/repo/issue | |
parent | c59a057297c782f44a81a3e630b5094a58099edb (diff) | |
download | gitea-e95b42e187cde9ac4bd541cd714bdb4f5c1fd8bc.tar.gz gitea-e95b42e187cde9ac4bd541cd714bdb4f5c1fd8bc.zip |
Improve accessibility when (re-)viewing files (#24817)
Visually, nothing should have changed.
Changes include
- Convert most `<a [no href]>` to `<button>` when (re-)viewing files:
- `<a [no href]>` are, by HTML definition, not a link and hence cannot
be focused
- `<a class="ui button">` can now be clicked (again?) using
<kbd>Enter</kbd>
- Previously, the installed keypress handler on `.ui.button` elements
disabled it for links somehow
- The `(un)escape file`, the `expand section` and the `expand/collapse
file` buttons can now be focused (and subsequently clicked using only
the keyboard)
- You can now press <kbd>Space</kbd> on a focused `View file` checkbox
to mark the file as viewed.
- previously, this was impossible as this checkbox listened on the wrong
event listener
The `add code comment` button has been left inaccessible for now as it
requires quite a bit of extra logic so that it is unhidden when it is
focused (you can otherwise focus it without seeing it as you are not
hovering on the corresponding line).
---------
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'templates/repo/issue')
-rw-r--r-- | templates/repo/issue/labels/labels_selector_field.tmpl | 4 | ||||
-rw-r--r-- | templates/repo/issue/view_title.tmpl | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/templates/repo/issue/labels/labels_selector_field.tmpl b/templates/repo/issue/labels/labels_selector_field.tmpl index 00d852bba9..350cf631e8 100644 --- a/templates/repo/issue/labels/labels_selector_field.tmpl +++ b/templates/repo/issue/labels/labels_selector_field.tmpl @@ -1,10 +1,10 @@ <div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-label dropdown"> - <a class="text gt-df gt-ac muted"> + <span class="text gt-df gt-ac muted"> <strong>{{.locale.Tr "repo.issues.new.labels"}}</strong> {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} {{svg "octicon-gear" 16 "gt-ml-2"}} {{end}} - </a> + </span> <div class="filter menu" {{if .Issue}}data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/labels"{{else}}data-id="#label_ids"{{end}}> <div class="header" style="text-transform: none;font-size:16px;">{{.locale.Tr "repo.issues.new.add_labels_title"}}</div> {{if or .Labels .OrgLabels}} diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl index f9febbde01..0857025495 100644 --- a/templates/repo/issue/view_title.tmpl +++ b/templates/repo/issue/view_title.tmpl @@ -45,12 +45,12 @@ {{if .Issue.IsPull}} {{$headHref := .HeadTarget|Escape}} {{if .HeadBranchLink}} - {{$headHref = printf "<a href=\"%s\">%s</a>" (.HeadBranchLink | Escape) $headHref}} + {{$headHref = printf `<a href="%s">%s</a>` (.HeadBranchLink | Escape) $headHref}} {{end}} - {{$headHref = printf "%s <a data-tooltip-content=\"%s\" data-clipboard-text=\"%s\">%s</a>" $headHref (.locale.Tr "copy_branch") (.HeadTarget | Escape) (svg "octicon-copy" 14)}} + {{$headHref = printf `%s <button class="button button-ghost" data-tooltip-content="%s" data-clipboard-text="%s">%s</button>` $headHref (.locale.Tr "copy_branch") (.HeadTarget | Escape) (svg "octicon-copy" 14)}} {{$baseHref := .BaseTarget|Escape}} {{if .BaseBranchLink}} - {{$baseHref = printf "<a href=\"%s\">%s</a>" (.BaseBranchLink | Escape) $baseHref}} + {{$baseHref = printf `<a href="%s">%s</a>` (.BaseBranchLink | Escape) $baseHref}} {{end}} {{if .Issue.PullRequest.HasMerged}} {{$mergedStr:= TimeSinceUnix .Issue.PullRequest.MergedUnix $.locale}} |