Skip to content

Commit 4fdb09d

Browse files
wxiaoguangGiteaBot
andauthored
Fix incorrect "tabindex" attributes (#26733)
Fix #26731 Almost all "tabindex" in code are incorrect. 1. All "input/button" by default are focusable, so no need to use "tabindex=0" 2. All "div/span" by default are not focusable, so no need to use "tabindex=-1" 3. All "dropdown" are focusable by framework, so no need to use "tabindex" 4. Some tabindex values are incorrect (eg: `new_form.tmpl`), so remove them Co-authored-by: Giteabot <teabot@gitea.io>
1 parent 576644d commit 4fdb09d

File tree

11 files changed

+54
-55
lines changed

11 files changed

+54
-55
lines changed

templates/org/create.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
<span class="inline required field"><label for="visibility">{{.locale.Tr "org.settings.visibility"}}</label></span>
2020
<div class="inline-grouped-list">
2121
<div class="ui radio checkbox">
22-
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="0" {{if .DefaultOrgVisibilityMode.IsPublic}}checked{{end}}>
22+
<input class="enable-system-radio" name="visibility" type="radio" value="0" {{if .DefaultOrgVisibilityMode.IsPublic}}checked{{end}}>
2323
<label>{{.locale.Tr "org.settings.visibility.public"}}</label>
2424
</div>
2525
<div class="ui radio checkbox">
26-
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="1" {{if .DefaultOrgVisibilityMode.IsLimited}}checked{{end}}>
26+
<input class="enable-system-radio" name="visibility" type="radio" value="1" {{if .DefaultOrgVisibilityMode.IsLimited}}checked{{end}}>
2727
<label>{{.locale.Tr "org.settings.visibility.limited"}}</label>
2828
</div>
2929
<div class="ui radio checkbox">
30-
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="2" {{if .DefaultOrgVisibilityMode.IsPrivate}}checked{{end}}>
30+
<input class="enable-system-radio" name="visibility" type="radio" value="2" {{if .DefaultOrgVisibilityMode.IsPrivate}}checked{{end}}>
3131
<label>{{.locale.Tr "org.settings.visibility.private"}}</label>
3232
</div>
3333
</div>

templates/org/settings/options.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@
4040
<label for="visibility">{{.locale.Tr "org.settings.visibility"}}</label>
4141
<div class="field">
4242
<div class="ui radio checkbox">
43-
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="0" {{if eq .CurrentVisibility 0}}checked{{end}}>
43+
<input class="enable-system-radio" name="visibility" type="radio" value="0" {{if eq .CurrentVisibility 0}}checked{{end}}>
4444
<label>{{.locale.Tr "org.settings.visibility.public"}}</label>
4545
</div>
4646
</div>
4747
<div class="field">
4848
<div class="ui radio checkbox">
49-
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="1" {{if eq .CurrentVisibility 1}}checked{{end}}>
49+
<input class="enable-system-radio" name="visibility" type="radio" value="1" {{if eq .CurrentVisibility 1}}checked{{end}}>
5050
<label>{{.locale.Tr "org.settings.visibility.limited"}}</label>
5151
</div>
5252
</div>
5353
<div class="field">
5454
<div class="ui radio checkbox">
55-
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="2" {{if eq .CurrentVisibility 2}}checked{{end}}>
55+
<input class="enable-system-radio" name="visibility" type="radio" value="2" {{if eq .CurrentVisibility 2}}checked{{end}}>
5656
<label>{{.locale.Tr "org.settings.visibility.private"}}</label>
5757
</div>
5858
</div>

templates/projects/view.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@
7676
</div>
7777
{{if and $canWriteProject (ne .ID 0)}}
7878
<div class="ui dropdown jump item">
79-
<div class="gt-px-3" tabindex="-1">
79+
<div class="gt-px-3">
8080
{{svg "octicon-kebab-horizontal"}}
8181
</div>
82-
<div class="menu user-menu" tabindex="-1">
82+
<div class="menu user-menu">
8383
<a class="item show-modal button" data-modal="#edit-project-column-modal-{{.ID}}">
8484
{{svg "octicon-pencil"}}
8585
{{ctx.Locale.Tr "repo.projects.column.edit"}}

templates/repo/create.tmpl

+9-9
Original file line numberDiff line numberDiff line change
@@ -77,40 +77,40 @@
7777
<div class="inline field">
7878
<label>{{.locale.Tr "repo.template.items"}}</label>
7979
<div class="ui checkbox">
80-
<input name="git_content" type="checkbox" tabindex="0" {{if .git_content}}checked{{end}}>
80+
<input name="git_content" type="checkbox" {{if .git_content}}checked{{end}}>
8181
<label>{{.locale.Tr "repo.template.git_content"}}</label>
8282
</div>
8383
<div class="ui checkbox" {{if not .SignedUser.CanEditGitHook}}data-tooltip-content="{{.locale.Tr "repo.template.git_hooks_tooltip"}}"{{end}}>
84-
<input name="git_hooks" type="checkbox" tabindex="0" {{if .git_hooks}}checked{{end}}>
84+
<input name="git_hooks" type="checkbox" {{if .git_hooks}}checked{{end}}>
8585
<label>{{.locale.Tr "repo.template.git_hooks"}}</label>
8686
</div>
8787
</div>
8888
<div class="inline field">
8989
<label></label>
9090
<div class="ui checkbox">
91-
<input name="webhooks" type="checkbox" tabindex="0" {{if .webhooks}}checked{{end}}>
91+
<input name="webhooks" type="checkbox" {{if .webhooks}}checked{{end}}>
9292
<label>{{.locale.Tr "repo.template.webhooks"}}</label>
9393
</div>
9494
<div class="ui checkbox">
95-
<input name="topics" type="checkbox" tabindex="0" {{if .topics}}checked{{end}}>
95+
<input name="topics" type="checkbox" {{if .topics}}checked{{end}}>
9696
<label>{{.locale.Tr "repo.template.topics"}}</label>
9797
</div>
9898
</div>
9999
<div class="inline field">
100100
<label></label>
101101
<div class="ui checkbox">
102-
<input name="avatar" type="checkbox" tabindex="0" {{if .avatar}}checked{{end}}>
102+
<input name="avatar" type="checkbox" {{if .avatar}}checked{{end}}>
103103
<label>{{.locale.Tr "repo.template.avatar"}}</label>
104104
</div>
105105
<div class="ui checkbox">
106-
<input name="labels" type="checkbox" tabindex="0" {{if .labels}}checked{{end}}>
106+
<input name="labels" type="checkbox" {{if .labels}}checked{{end}}>
107107
<label>{{.locale.Tr "repo.template.issue_labels"}}</label>
108108
</div>
109109
</div>
110110
<div class="inline field">
111111
<label></label>
112112
<div class="ui checkbox">
113-
<input name="protected_branch" type="checkbox" tabindex="0" {{if .protected_branch}}checked{{end}}>
113+
<input name="protected_branch" type="checkbox" {{if .protected_branch}}checked{{end}}>
114114
<label>{{.locale.Tr "repo.settings.protected_branch"}}</label>
115115
</div>
116116
</div>
@@ -176,7 +176,7 @@
176176
</div>
177177
<div class="inline field">
178178
<div class="ui checkbox" id="auto-init">
179-
<input name="auto_init" type="checkbox" tabindex="0" {{if .auto_init}}checked{{end}}>
179+
<input name="auto_init" type="checkbox" {{if .auto_init}}checked{{end}}>
180180
<label>{{.locale.Tr "repo.auto_init"}}</label>
181181
</div>
182182
</div>
@@ -211,7 +211,7 @@
211211
<div class="inline field">
212212
<label>{{.locale.Tr "repo.template"}}</label>
213213
<div class="ui checkbox">
214-
<input name="template" type="checkbox" tabindex="0">
214+
<input name="template" type="checkbox">
215215
<label>{{.locale.Tr "repo.template_helper"}}</label>
216216
</div>
217217
</div>

templates/repo/editor/commit_form.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</div>
1717
<div class="inline field">
1818
<div class="ui checkbox">
19-
<input name="signoff" type="checkbox" tabindex="0">
19+
<input name="signoff" type="checkbox">
2020
<label>{{.locale.Tr "repo.editor.signoff_desc"}}</label>
2121
</div>
2222
</div>

templates/repo/issue/new_form.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{{ctx.AvatarUtils.Avatar .SignedUser 40}}
1212
<div class="ui segment content gt-my-0">
1313
<div class="field">
14-
<input name="title" id="issue_title" placeholder="{{.locale.Tr "repo.milestones.title"}}" value="{{if .TitleQuery}}{{.TitleQuery}}{{else if .IssueTemplateTitle}}{{.IssueTemplateTitle}}{{else}}{{.title}}{{end}}" tabindex="3" autofocus required maxlength="255" autocomplete="off">
14+
<input name="title" id="issue_title" placeholder="{{.locale.Tr "repo.milestones.title"}}" value="{{if .TitleQuery}}{{.TitleQuery}}{{else if .IssueTemplateTitle}}{{.IssueTemplateTitle}}{{else}}{{.title}}{{end}}" autofocus required maxlength="255" autocomplete="off">
1515
{{if .PageIsComparePull}}
1616
<div class="title_wip_desc" data-wip-prefixes="{{JsonUtils.EncodeToString .PullRequestWorkInProgressPrefixes}}">{{.locale.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0| Escape) | Safe}}</div>
1717
{{end}}
@@ -35,7 +35,7 @@
3535
{{template "repo/issue/comment_tab" .}}
3636
{{end}}
3737
<div class="text right">
38-
<button class="ui green button" tabindex="6">
38+
<button class="ui green button">
3939
{{if .PageIsComparePull}}
4040
{{.locale.Tr "repo.pulls.create"}}
4141
{{else}}

templates/repo/issue/view_content/sidebar.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@
621621
</div>
622622

623623
<div class="field">
624-
<div class="ui fluid dropdown selection" tabindex="0">
624+
<div class="ui fluid dropdown selection">
625625

626626
<select name="reason">
627627
<option value=""> </option>

templates/repo/settings/options.tmpl

+5-5
Original file line numberDiff line numberDiff line change
@@ -315,13 +315,13 @@
315315
<div class="field{{if not $isWikiEnabled}} disabled{{end}}" id="wiki_box">
316316
<div class="field">
317317
<div class="ui radio checkbox{{if $isWikiGlobalDisabled}} disabled{{end}}"{{if $isWikiGlobalDisabled}} data-tooltip-content="{{.locale.Tr "repo.unit_disabled"}}"{{end}}>
318-
<input class="enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="false" data-target="#external_wiki_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}checked{{end}}>
318+
<input class="enable-system-radio" name="enable_external_wiki" type="radio" value="false" data-target="#external_wiki_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}checked{{end}}>
319319
<label>{{.locale.Tr "repo.settings.use_internal_wiki"}}</label>
320320
</div>
321321
</div>
322322
<div class="field">
323323
<div class="ui radio checkbox{{if $isExternalWikiGlobalDisabled}} disabled{{end}}"{{if $isExternalWikiGlobalDisabled}} data-tooltip-content="{{.locale.Tr "repo.unit_disabled"}}"{{end}}>
324-
<input class="enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="true" data-target="#external_wiki_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalWiki}}checked{{end}}>
324+
<input class="enable-system-radio" name="enable_external_wiki" type="radio" value="true" data-target="#external_wiki_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalWiki}}checked{{end}}>
325325
<label>{{.locale.Tr "repo.settings.use_external_wiki"}}</label>
326326
</div>
327327
</div>
@@ -348,7 +348,7 @@
348348
<div class="field {{if not $isIssuesEnabled}}disabled{{end}}" id="issue_box">
349349
<div class="field">
350350
<div class="ui radio checkbox{{if $isIssuesGlobalDisabled}} disabled{{end}}"{{if $isIssuesGlobalDisabled}} data-tooltip-content="{{.locale.Tr "repo.unit_disabled"}}"{{end}}>
351-
<input class="enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="false" data-context="#internal_issue_box" data-target="#external_issue_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}checked{{end}}>
351+
<input class="enable-system-radio" name="enable_external_tracker" type="radio" value="false" data-context="#internal_issue_box" data-target="#external_issue_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}checked{{end}}>
352352
<label>{{.locale.Tr "repo.settings.use_internal_issue_tracker"}}</label>
353353
</div>
354354
</div>
@@ -380,7 +380,7 @@
380380
</div>
381381
<div class="field">
382382
<div class="ui radio checkbox{{if $isExternalTrackerGlobalDisabled}} disabled{{end}}"{{if $isExternalTrackerGlobalDisabled}} data-tooltip-content="{{.locale.Tr "repo.unit_disabled"}}"{{end}}>
383-
<input class="enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="true" data-context="#internal_issue_box" data-target="#external_issue_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalTracker}}checked{{end}}>
383+
<input class="enable-system-radio" name="enable_external_tracker" type="radio" value="true" data-context="#internal_issue_box" data-target="#external_issue_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalTracker}}checked{{end}}>
384384
<label>{{.locale.Tr "repo.settings.use_external_issue_tracker"}}</label>
385385
</div>
386386
</div>
@@ -523,7 +523,7 @@
523523
<p>
524524
{{.locale.Tr "repo.settings.default_merge_style_desc"}}
525525
</p>
526-
<div class="ui dropdown selection" tabindex="0">
526+
<div class="ui dropdown selection">
527527
<select name="pulls_default_merge_style">
528528
<option value="merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "merge")}}selected{{end}}>{{.locale.Tr "repo.pulls.merge_pull_request"}}</option>
529529
<option value="rebase" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase")}}selected{{end}}>{{.locale.Tr "repo.pulls.rebase_merge_pull_request"}}</option>

0 commit comments

Comments
 (0)