diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-08-26 10:44:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-26 10:44:00 +0800 |
commit | 4fdb09de588fb1ff32184411df80d5d59333b94c (patch) | |
tree | 5fb304d5be73ce7a4e6e0f29b95a7b91b13730d1 /templates/repo | |
parent | 576644d81555cfcd7c865d444285cad64cc0b9ec (diff) | |
download | gitea-4fdb09de588fb1ff32184411df80d5d59333b94c.tar.gz gitea-4fdb09de588fb1ff32184411df80d5d59333b94c.zip |
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>
Diffstat (limited to 'templates/repo')
-rw-r--r-- | templates/repo/create.tmpl | 18 | ||||
-rw-r--r-- | templates/repo/editor/commit_form.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/new_form.tmpl | 4 | ||||
-rw-r--r-- | templates/repo/issue/view_content/sidebar.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/settings/options.tmpl | 10 | ||||
-rw-r--r-- | templates/repo/settings/webhook/settings.tmpl | 46 |
6 files changed, 41 insertions, 41 deletions
diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index 2025cac566..0fcdf13f1e 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -77,40 +77,40 @@ <div class="inline field"> <label>{{.locale.Tr "repo.template.items"}}</label> <div class="ui checkbox"> - <input name="git_content" type="checkbox" tabindex="0" {{if .git_content}}checked{{end}}> + <input name="git_content" type="checkbox" {{if .git_content}}checked{{end}}> <label>{{.locale.Tr "repo.template.git_content"}}</label> </div> <div class="ui checkbox" {{if not .SignedUser.CanEditGitHook}}data-tooltip-content="{{.locale.Tr "repo.template.git_hooks_tooltip"}}"{{end}}> - <input name="git_hooks" type="checkbox" tabindex="0" {{if .git_hooks}}checked{{end}}> + <input name="git_hooks" type="checkbox" {{if .git_hooks}}checked{{end}}> <label>{{.locale.Tr "repo.template.git_hooks"}}</label> </div> </div> <div class="inline field"> <label></label> <div class="ui checkbox"> - <input name="webhooks" type="checkbox" tabindex="0" {{if .webhooks}}checked{{end}}> + <input name="webhooks" type="checkbox" {{if .webhooks}}checked{{end}}> <label>{{.locale.Tr "repo.template.webhooks"}}</label> </div> <div class="ui checkbox"> - <input name="topics" type="checkbox" tabindex="0" {{if .topics}}checked{{end}}> + <input name="topics" type="checkbox" {{if .topics}}checked{{end}}> <label>{{.locale.Tr "repo.template.topics"}}</label> </div> </div> <div class="inline field"> <label></label> <div class="ui checkbox"> - <input name="avatar" type="checkbox" tabindex="0" {{if .avatar}}checked{{end}}> + <input name="avatar" type="checkbox" {{if .avatar}}checked{{end}}> <label>{{.locale.Tr "repo.template.avatar"}}</label> </div> <div class="ui checkbox"> - <input name="labels" type="checkbox" tabindex="0" {{if .labels}}checked{{end}}> + <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> <label>{{.locale.Tr "repo.template.issue_labels"}}</label> </div> </div> <div class="inline field"> <label></label> <div class="ui checkbox"> - <input name="protected_branch" type="checkbox" tabindex="0" {{if .protected_branch}}checked{{end}}> + <input name="protected_branch" type="checkbox" {{if .protected_branch}}checked{{end}}> <label>{{.locale.Tr "repo.settings.protected_branch"}}</label> </div> </div> @@ -176,7 +176,7 @@ </div> <div class="inline field"> <div class="ui checkbox" id="auto-init"> - <input name="auto_init" type="checkbox" tabindex="0" {{if .auto_init}}checked{{end}}> + <input name="auto_init" type="checkbox" {{if .auto_init}}checked{{end}}> <label>{{.locale.Tr "repo.auto_init"}}</label> </div> </div> @@ -211,7 +211,7 @@ <div class="inline field"> <label>{{.locale.Tr "repo.template"}}</label> <div class="ui checkbox"> - <input name="template" type="checkbox" tabindex="0"> + <input name="template" type="checkbox"> <label>{{.locale.Tr "repo.template_helper"}}</label> </div> </div> diff --git a/templates/repo/editor/commit_form.tmpl b/templates/repo/editor/commit_form.tmpl index 5833687753..b07059777f 100644 --- a/templates/repo/editor/commit_form.tmpl +++ b/templates/repo/editor/commit_form.tmpl @@ -16,7 +16,7 @@ </div> <div class="inline field"> <div class="ui checkbox"> - <input name="signoff" type="checkbox" tabindex="0"> + <input name="signoff" type="checkbox"> <label>{{.locale.Tr "repo.editor.signoff_desc"}}</label> </div> </div> diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index ae43d70c4a..ca1ff287d0 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -11,7 +11,7 @@ {{ctx.AvatarUtils.Avatar .SignedUser 40}} <div class="ui segment content gt-my-0"> <div class="field"> - <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"> + <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"> {{if .PageIsComparePull}} <div class="title_wip_desc" data-wip-prefixes="{{JsonUtils.EncodeToString .PullRequestWorkInProgressPrefixes}}">{{.locale.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0| Escape) | Safe}}</div> {{end}} @@ -35,7 +35,7 @@ {{template "repo/issue/comment_tab" .}} {{end}} <div class="text right"> - <button class="ui green button" tabindex="6"> + <button class="ui green button"> {{if .PageIsComparePull}} {{.locale.Tr "repo.pulls.create"}} {{else}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index c150a9cdcd..ff4239bbb7 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -621,7 +621,7 @@ </div> <div class="field"> - <div class="ui fluid dropdown selection" tabindex="0"> + <div class="ui fluid dropdown selection"> <select name="reason"> <option value=""> </option> diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 012368fb94..418a80e831 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -315,13 +315,13 @@ <div class="field{{if not $isWikiEnabled}} disabled{{end}}" id="wiki_box"> <div class="field"> <div class="ui radio checkbox{{if $isWikiGlobalDisabled}} disabled{{end}}"{{if $isWikiGlobalDisabled}} data-tooltip-content="{{.locale.Tr "repo.unit_disabled"}}"{{end}}> - <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}}> + <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}}> <label>{{.locale.Tr "repo.settings.use_internal_wiki"}}</label> </div> </div> <div class="field"> <div class="ui radio checkbox{{if $isExternalWikiGlobalDisabled}} disabled{{end}}"{{if $isExternalWikiGlobalDisabled}} data-tooltip-content="{{.locale.Tr "repo.unit_disabled"}}"{{end}}> - <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}}> + <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}}> <label>{{.locale.Tr "repo.settings.use_external_wiki"}}</label> </div> </div> @@ -348,7 +348,7 @@ <div class="field {{if not $isIssuesEnabled}}disabled{{end}}" id="issue_box"> <div class="field"> <div class="ui radio checkbox{{if $isIssuesGlobalDisabled}} disabled{{end}}"{{if $isIssuesGlobalDisabled}} data-tooltip-content="{{.locale.Tr "repo.unit_disabled"}}"{{end}}> - <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}}> + <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}}> <label>{{.locale.Tr "repo.settings.use_internal_issue_tracker"}}</label> </div> </div> @@ -380,7 +380,7 @@ </div> <div class="field"> <div class="ui radio checkbox{{if $isExternalTrackerGlobalDisabled}} disabled{{end}}"{{if $isExternalTrackerGlobalDisabled}} data-tooltip-content="{{.locale.Tr "repo.unit_disabled"}}"{{end}}> - <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}}> + <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}}> <label>{{.locale.Tr "repo.settings.use_external_issue_tracker"}}</label> </div> </div> @@ -523,7 +523,7 @@ <p> {{.locale.Tr "repo.settings.default_merge_style_desc"}} </p> - <div class="ui dropdown selection" tabindex="0"> + <div class="ui dropdown selection"> <select name="pulls_default_merge_style"> <option value="merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "merge")}}selected{{end}}>{{.locale.Tr "repo.pulls.merge_pull_request"}}</option> <option value="rebase" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase")}}selected{{end}}>{{.locale.Tr "repo.pulls.rebase_merge_pull_request"}}</option> diff --git a/templates/repo/settings/webhook/settings.tmpl b/templates/repo/settings/webhook/settings.tmpl index e22b3da7ab..d84c8eb110 100644 --- a/templates/repo/settings/webhook/settings.tmpl +++ b/templates/repo/settings/webhook/settings.tmpl @@ -31,7 +31,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="create" type="checkbox" tabindex="0" {{if .Webhook.Create}}checked{{end}}> + <input name="create" type="checkbox" {{if .Webhook.Create}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_create"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_create_desc"}}</span> </div> @@ -41,7 +41,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="delete" type="checkbox" tabindex="0" {{if .Webhook.Delete}}checked{{end}}> + <input name="delete" type="checkbox" {{if .Webhook.Delete}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_delete"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_delete_desc"}}</span> </div> @@ -51,7 +51,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="fork" type="checkbox" tabindex="0" {{if .Webhook.Fork}}checked{{end}}> + <input name="fork" type="checkbox" {{if .Webhook.Fork}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_fork"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_fork_desc"}}</span> </div> @@ -61,7 +61,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="push" type="checkbox" tabindex="0" {{if .Webhook.Push}}checked{{end}}> + <input name="push" type="checkbox" {{if .Webhook.Push}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_push"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_push_desc"}}</span> </div> @@ -71,7 +71,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="repository" type="checkbox" tabindex="0" {{if .Webhook.Repository}}checked{{end}}> + <input name="repository" type="checkbox" {{if .Webhook.Repository}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_repository"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_repository_desc"}}</span> </div> @@ -81,7 +81,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="release" type="checkbox" tabindex="0" {{if .Webhook.Release}}checked{{end}}> + <input name="release" type="checkbox" {{if .Webhook.Release}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_release"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_release_desc"}}</span> </div> @@ -91,7 +91,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="package" type="checkbox" tabindex="0" {{if .Webhook.Package}}checked{{end}}> + <input name="package" type="checkbox" {{if .Webhook.Package}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_package"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_package_desc"}}</span> </div> @@ -102,7 +102,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="wiki" type="checkbox" tabindex="0" {{if .Webhook.Wiki}}checked{{end}}> + <input name="wiki" type="checkbox" {{if .Webhook.Wiki}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_wiki"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_wiki_desc"}}</span> </div> @@ -117,7 +117,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issues" type="checkbox" tabindex="0" {{if .Webhook.Issues}}checked{{end}}> + <input name="issues" type="checkbox" {{if .Webhook.Issues}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_issues"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_issues_desc"}}</span> </div> @@ -127,7 +127,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issue_assign" type="checkbox" tabindex="0" {{if .Webhook.IssueAssign}}checked{{end}}> + <input name="issue_assign" type="checkbox" {{if .Webhook.IssueAssign}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_issue_assign"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_issue_assign_desc"}}</span> </div> @@ -137,7 +137,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issue_label" type="checkbox" tabindex="0" {{if .Webhook.IssueLabel}}checked{{end}}> + <input name="issue_label" type="checkbox" {{if .Webhook.IssueLabel}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_issue_label"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_issue_label_desc"}}</span> </div> @@ -147,7 +147,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issue_milestone" type="checkbox" tabindex="0" {{if .Webhook.IssueMilestone}}checked{{end}}> + <input name="issue_milestone" type="checkbox" {{if .Webhook.IssueMilestone}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_issue_milestone"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_issue_milestone_desc"}}</span> </div> @@ -157,7 +157,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issue_comment" type="checkbox" tabindex="0" {{if .Webhook.IssueComment}}checked{{end}}> + <input name="issue_comment" type="checkbox" {{if .Webhook.IssueComment}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_issue_comment"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_issue_comment_desc"}}</span> </div> @@ -172,7 +172,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request" type="checkbox" tabindex="0" {{if .Webhook.PullRequest}}checked{{end}}> + <input name="pull_request" type="checkbox" {{if .Webhook.PullRequest}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_pull_request"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_pull_request_desc"}}</span> </div> @@ -182,7 +182,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_assign" type="checkbox" tabindex="0" {{if .Webhook.PullRequestAssign}}checked{{end}}> + <input name="pull_request_assign" type="checkbox" {{if .Webhook.PullRequestAssign}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_pull_request_assign"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_pull_request_assign_desc"}}</span> </div> @@ -192,7 +192,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_label" type="checkbox" tabindex="0" {{if .Webhook.PullRequestLabel}}checked{{end}}> + <input name="pull_request_label" type="checkbox" {{if .Webhook.PullRequestLabel}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_pull_request_label"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_pull_request_label_desc"}}</span> </div> @@ -202,7 +202,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_milestone" type="checkbox" tabindex="0" {{if .Webhook.PullRequestMilestone}}checked{{end}}> + <input name="pull_request_milestone" type="checkbox" {{if .Webhook.PullRequestMilestone}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_pull_request_milestone"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_pull_request_milestone_desc"}}</span> </div> @@ -212,7 +212,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_comment" type="checkbox" tabindex="0" {{if .Webhook.PullRequestComment}}checked{{end}}> + <input name="pull_request_comment" type="checkbox" {{if .Webhook.PullRequestComment}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_pull_request_comment"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_pull_request_comment_desc"}}</span> </div> @@ -222,7 +222,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_review" type="checkbox" tabindex="0" {{if .Webhook.PullRequestReview}}checked{{end}}> + <input name="pull_request_review" type="checkbox" {{if .Webhook.PullRequestReview}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_pull_request_review"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_pull_request_review_desc"}}</span> </div> @@ -232,7 +232,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_sync" type="checkbox" tabindex="0" {{if .Webhook.PullRequestSync}}checked{{end}}> + <input name="pull_request_sync" type="checkbox" {{if .Webhook.PullRequestSync}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_pull_request_sync"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_pull_request_sync_desc"}}</span> </div> @@ -242,7 +242,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_review_request" type="checkbox" tabindex="0" {{if .Webhook.PullRequestReviewRequest}}checked{{end}}> + <input name="pull_request_review_request" type="checkbox" {{if .Webhook.PullRequestReviewRequest}}checked{{end}}> <label>{{.locale.Tr "repo.settings.event_pull_request_review_request"}}</label> <span class="help">{{.locale.Tr "repo.settings.event_pull_request_review_request_desc"}}</span> </div> @@ -254,7 +254,7 @@ <!-- Branch filter --> <div class="field"> <label for="branch_filter">{{.locale.Tr "repo.settings.branch_filter"}}</label> - <input name="branch_filter" type="text" tabindex="0" value="{{or .Webhook.BranchFilter "*"}}"> + <input name="branch_filter" type="text" value="{{or .Webhook.BranchFilter "*"}}"> <span class="help">{{.locale.Tr "repo.settings.branch_filter_desc" | Str2html}}</span> </div> @@ -271,7 +271,7 @@ <div class="inline field"> <div class="ui checkbox"> - <input name="active" type="checkbox" tabindex="0" {{if or $isNew .Webhook.IsActive}}checked{{end}}> + <input name="active" type="checkbox" {{if or $isNew .Webhook.IsActive}}checked{{end}}> <label>{{.locale.Tr "repo.settings.active"}}</label> <span class="help">{{.locale.Tr "repo.settings.active_helper"}}</span> </div> |