aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordelvh <leon@kske.dev>2023-03-14 04:34:09 +0100
committerGitHub <noreply@github.com>2023-03-14 11:34:09 +0800
commit81fe5d61851c0e586af7d32c29171ceff9a571bb (patch)
tree40ea13c9726cfca88a83800b323b428438cd90e9
parent605fd15ad6eda19dba8f5e8a8f2e595e34e6c6ee (diff)
downloadgitea-81fe5d61851c0e586af7d32c29171ceff9a571bb.tar.gz
gitea-81fe5d61851c0e586af7d32c29171ceff9a571bb.zip
Convert `<div class="button">` to `<button class="button">` (#23337)
This improves a lot of accessibility shortcomings. Every possible instance of `<div class="button">` matching the command `ag '<[^ab].*?class=.*?[" ]button[ "]' templates/ | grep -v 'dropdown'` has been converted when possible. divs with the `dropdown` class and their children were omitted as 1. more analysis must be conducted whether the dropdowns still work as intended when they are a `button` instead of a `div`. 2. most dropdowns have `div`s as children. The HTML standard disallows `div`s inside `button`s. 3. When a dropdown child that's part of the displayed text content is converted to a `button`, the dropdown can be focused twice Further changes include that all "gitea-managed" buttons with JS code received an `e.preventDefault()` so that they don't accidentally submit an underlying form, which would execute instead of cancel the action. Lastly, some minor issues were fixed as well during the refactoring. ## Future improvements As mentioned in https://github.com/go-gitea/gitea/pull/23337#discussion_r1127277391, `<a>`s without `href` attribute are not focusable. They should later on be converted to `<button>`s. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
-rw-r--r--public/img/svg/fontawesome-save.svg1
-rw-r--r--templates/admin/auth/edit.tmpl2
-rw-r--r--templates/admin/emails/list.tmpl8
-rw-r--r--templates/admin/notice.tmpl18
-rw-r--r--templates/admin/repo/unadopted.tmpl22
-rw-r--r--templates/admin/user/edit.tmpl15
-rw-r--r--templates/base/delete_modal_actions.tmpl8
-rw-r--r--templates/org/settings/delete.tmpl4
-rw-r--r--templates/org/settings/labels.tmpl2
-rw-r--r--templates/package/settings.tmpl5
-rw-r--r--templates/projects/list.tmpl11
-rw-r--r--templates/projects/view.tmpl21
-rw-r--r--templates/repo/branch/list.tmpl2
-rw-r--r--templates/repo/cite/cite_modal.tmpl4
-rw-r--r--templates/repo/commit_page.tmpl4
-rw-r--r--templates/repo/diff/box.tmpl8
-rw-r--r--templates/repo/editor/edit.tmpl8
-rw-r--r--templates/repo/editor/patch.tmpl12
-rw-r--r--templates/repo/issue/labels.tmpl2
-rw-r--r--templates/repo/issue/labels/edit_delete_label.tmpl21
-rw-r--r--templates/repo/issue/labels/label_new.tmpl11
-rw-r--r--templates/repo/issue/list.tmpl4
-rw-r--r--templates/repo/issue/milestone_issues.tmpl4
-rw-r--r--templates/repo/issue/milestones.tmpl11
-rw-r--r--templates/repo/issue/view_content.tmpl20
-rw-r--r--templates/repo/issue/view_content/comments_delete_time.tmpl5
-rw-r--r--templates/repo/issue/view_content/pull.tmpl2
-rw-r--r--templates/repo/issue/view_content/sidebar.tmpl16
-rw-r--r--templates/repo/issue/view_content/update_branch_by_merge.tmpl4
-rw-r--r--templates/repo/issue/view_title.tmpl4
-rw-r--r--templates/repo/migrate/migrating.tmpl2
-rw-r--r--templates/repo/projects/list.tmpl11
-rw-r--r--templates/repo/projects/view.tmpl21
-rw-r--r--templates/repo/release/new.tmpl6
-rw-r--r--templates/repo/settings/deploy_keys.tmpl15
-rw-r--r--templates/repo/settings/lfs.tmpl4
-rw-r--r--templates/repo/settings/lfs_pointers.tmpl4
-rw-r--r--templates/repo/settings/options.tmpl15
-rw-r--r--templates/repo/settings/webhook/delete_modal.tmpl11
-rw-r--r--templates/repo/unicode_escape_prompt.tmpl4
-rw-r--r--templates/shared/actions/runner_list.tmpl4
-rw-r--r--templates/shared/secrets/add_list.tmpl2
-rw-r--r--templates/user/auth/grant.tmpl2
-rw-r--r--templates/user/auth/webauthn_error.tmpl2
-rw-r--r--templates/user/settings/account.tmpl4
-rw-r--r--templates/user/settings/applications.tmpl15
-rw-r--r--templates/user/settings/keys_gpg.tmpl2
-rw-r--r--templates/user/settings/keys_principal.tmpl4
-rw-r--r--templates/user/settings/keys_ssh.tmpl6
-rw-r--r--templates/user/settings/repos.tmpl22
-rw-r--r--templates/user/settings/security/twofa.tmpl2
-rw-r--r--web_src/js/features/admin/common.js3
-rw-r--r--web_src/js/features/common-global.js28
-rw-r--r--web_src/js/features/common-issue.js1
-rw-r--r--web_src/js/features/repo-issue.js3
-rw-r--r--web_src/js/features/repo-legacy.js3
-rw-r--r--web_src/svg/fontawesome-save.svg1
57 files changed, 173 insertions, 283 deletions
diff --git a/public/img/svg/fontawesome-save.svg b/public/img/svg/fontawesome-save.svg
new file mode 100644
index 0000000000..f7beb90d94
--- /dev/null
+++ b/public/img/svg/fontawesome-save.svg
@@ -0,0 +1 @@
+<svg viewBox="0 0 448 512" class="svg fontawesome-save" width="16" height="16" aria-hidden="true"><path d="m434 130-84-84a48 48 0 0 0-33.9-14H48A48 48 0 0 0 0 80v352a48 48 0 0 0 48 48h352a48 48 0 0 0 48-48V163.9a48 48 0 0 0-14-34zM224 416a64 64 0 1 1 0-128 64 64 0 0 1 0 128zm96-304.5V212a12 12 0 0 1-12 12H76a12 12 0 0 1-12-12V108a12 12 0 0 1 12-12h228.5a12 12 0 0 1 8.5 3.5l3.5 3.5a12 12 0 0 1 3.5 8.5z"/></svg> \ No newline at end of file
diff --git a/templates/admin/auth/edit.tmpl b/templates/admin/auth/edit.tmpl
index d64ee188af..c798be02ff 100644
--- a/templates/admin/auth/edit.tmpl
+++ b/templates/admin/auth/edit.tmpl
@@ -433,7 +433,7 @@
<div class="field">
<button class="ui green button">{{.locale.Tr "admin.auths.update"}}</button>
- <div class="ui red button delete-button" data-url="{{$.Link}}/delete" data-id="{{.Source.ID}}">{{.locale.Tr "admin.auths.delete"}}</div>
+ <button class="ui red button delete-button" data-url="{{$.Link}}/delete" data-id="{{.Source.ID}}">{{.locale.Tr "admin.auths.delete"}}</button>
</div>
</form>
</div>
diff --git a/templates/admin/emails/list.tmpl b/templates/admin/emails/list.tmpl
index 091f5011f9..d8fa986cff 100644
--- a/templates/admin/emails/list.tmpl
+++ b/templates/admin/emails/list.tmpl
@@ -78,7 +78,7 @@
{{.locale.Tr "admin.emails.change_email_header"}}
</div>
<div class="content center">
- <p>{{.locale.Tr "admin.emails.change_email_text"}}</p>
+ <p class="center">{{.locale.Tr "admin.emails.change_email_text"}}</p>
<form class="ui form" id="email-action-form" action="{{AppSubUrl}}/admin/emails/activate" method="post">
{{$.CsrfTokenHtml}}
@@ -93,11 +93,9 @@
<input type="hidden" id="form-primary" name="primary" value="" required>
<input type="hidden" id="form-activate" name="activate" value="" required>
- <div class="center actions">
- <div class="ui basic cancel inverted button">{{$.locale.Tr "settings.cancel"}}</div>
- <button class="ui basic inverted yellow button">{{$.locale.Tr "modal.yes"}}</button>
+ <div class="center">
+ {{template "base/delete_modal_actions" .}}
</div>
-
</form>
</div>
</div>
diff --git a/templates/admin/notice.tmpl b/templates/admin/notice.tmpl
index a2c7ca2f6a..34bd83a214 100644
--- a/templates/admin/notice.tmpl
+++ b/templates/admin/notice.tmpl
@@ -23,7 +23,7 @@
<tr>
<td class="collapsing">
<div class="ui fitted checkbox" data-id="{{.ID}}">
- <input type="checkbox"> <label></label>
+ <input type="checkbox">
</div>
</td>
<td>{{.ID}}</td>
@@ -39,13 +39,11 @@
<tr>
<th></th>
<th colspan="5">
- <div class="ui right">
- <form method="post" action="{{AppSubUrl}}/admin/notices/empty">
- {{.CsrfTokenHtml}}
- <button type="submit" class="ui red small button">{{.locale.Tr "admin.notices.delete_all"}}</button>
- </form>
- </div>
- <div class="ui floating upward dropdown small button">
+ <form class="ui right" method="post" action="{{AppSubUrl}}/admin/notices/empty">
+ {{.CsrfTokenHtml}}
+ <button type="submit" class="ui red small button">{{.locale.Tr "admin.notices.delete_all"}}</button>
+ </form>
+ <div class="ui floating upward dropdown small button">{{/* TODO: Make this dropdown accessible */}}
<span class="text">{{.locale.Tr "admin.notices.operations"}}</span>
<div class="menu">
<div class="item select action" data-action="select-all">
@@ -59,9 +57,9 @@
</div>
</div>
</div>
- <div class="ui small teal button" id="delete-selection" data-link="{{.Link}}/delete" data-redirect="{{.Link}}?page={{.Page.Paginater.Current}}">
+ <button class="ui small teal button" id="delete-selection" data-link="{{.Link}}/delete" data-redirect="{{.Link}}?page={{.Page.Paginater.Current}}">
{{.locale.Tr "admin.notices.delete_selected"}}
- </div>
+ </button>
</th>
</tr>
</tfoot>
diff --git a/templates/admin/repo/unadopted.tmpl b/templates/admin/repo/unadopted.tmpl
index 2629056d1d..7ff41d503a 100644
--- a/templates/admin/repo/unadopted.tmpl
+++ b/templates/admin/repo/unadopted.tmpl
@@ -43,16 +43,7 @@
<input type="hidden" name="action" value="adopt">
<input type="hidden" name="q" value="{{$.Keyword}}">
<input type="hidden" name="page" value="{{$.CurrentPage}}">
- <div class="actions">
- <div class="ui red basic inverted cancel button">
- {{svg "octicon-trash" 16 "gt-mr-2"}}
- {{$.locale.Tr "modal.no"}}
- </div>
- <button class="ui green basic inverted ok button">
- {{svg "octicon-check" 16 "gt-mr-2"}}
- {{$.locale.Tr "modal.yes"}}
- </button>
- </div>
+ {{template "base/delete_modal_actions" .}}
</form>
</div>
<button class="ui button submit tiny red delete show-modal" data-modal="#delete-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-x"}}</span><span class="label">{{$.locale.Tr "repo.delete_preexisting_label"}}</span></button>
@@ -70,16 +61,7 @@
<input type="hidden" name="action" value="delete">
<input type="hidden" name="q" value="{{$.Keyword}}">
<input type="hidden" name="page" value="{{$.CurrentPage}}">
- <div class="actions">
- <div class="ui red basic inverted cancel button">
- {{svg "octicon-trash" 16 "gt-mr-2"}}
- {{$.locale.Tr "modal.no"}}
- </div>
- <button class="ui green basic inverted ok button">
- {{svg "octicon-check" 16 "gt-mr-2"}}
- {{$.locale.Tr "modal.yes"}}
- </button>
- </div>
+ {{template "base/delete_modal_actions" .}}
</form>
</div>
</div>
diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl
index 5dd1f531fd..73017e1b13 100644
--- a/templates/admin/user/edit.tmpl
+++ b/templates/admin/user/edit.tmpl
@@ -151,7 +151,7 @@
<div class="field">
<button class="ui green button">{{.locale.Tr "admin.users.update_profile"}}</button>
- <div class="ui red button show-modal" data-modal="#delete-user-modal">{{.locale.Tr "admin.users.delete_account"}}</div>
+ <button class="ui red button show-modal" data-modal="#delete-user-modal">{{.locale.Tr "admin.users.delete_account"}}</button>
</div>
</form>
</div>
@@ -189,7 +189,7 @@
<div class="field">
<button class="ui green button">{{$.locale.Tr "settings.update_avatar"}}</button>
- <a class="ui red button delete-post" data-request-url="{{.Link}}/avatar/delete" data-done-url="{{.Link}}">{{$.locale.Tr "settings.delete_current_avatar"}}</a>
+ <a class="ui red button delete-post" data-request-url="{{.Link}}/avatar/delete" data-done-url="{{.Link}}">{{$.locale.Tr "settings.delete_current_avatar"}}</a>{{/* TODO: Convert links without href to buttons for a11y */}}
</div>
</form>
</div>
@@ -213,16 +213,7 @@
</div>
<p class="help">{{.locale.Tr "admin.users.purge_help"}}</p>
</div>
- <div class="actions">
- <div class="ui red basic inverted cancel button">
- {{svg "octicon-x"}}
- {{.locale.Tr "modal.no"}}
- </div>
- <button class="ui green basic inverted ok button">
- {{svg "octicon-check"}}
- {{.locale.Tr "modal.yes"}}
- </button>
- </div>
+ {{template "base/delete_modal_actions" .}}
</form>
</div>
{{template "base/footer" .}}
diff --git a/templates/base/delete_modal_actions.tmpl b/templates/base/delete_modal_actions.tmpl
index fb4d31270a..29bf5f92fd 100644
--- a/templates/base/delete_modal_actions.tmpl
+++ b/templates/base/delete_modal_actions.tmpl
@@ -1,10 +1,10 @@
<div class="actions">
- <div class="ui red basic inverted cancel button">
+ <button class="ui red basic inverted cancel button">
{{svg "octicon-x"}}
{{.locale.Tr "modal.no"}}
- </div>
- <div class="ui green basic inverted ok button">
+ </button>
+ <button class="ui green basic inverted ok button">
{{svg "octicon-check"}}
{{.locale.Tr "modal.yes"}}
- </div>
+ </button>
</div>
diff --git a/templates/org/settings/delete.tmpl b/templates/org/settings/delete.tmpl
index 669e393e1d..69e226f410 100644
--- a/templates/org/settings/delete.tmpl
+++ b/templates/org/settings/delete.tmpl
@@ -19,9 +19,9 @@
<label for="org_name">{{.locale.Tr "org.org_name_holder"}}</label>
<input id="org_name" name="org_name" value="" autocomplete="off" autofocus required>
</div>
- <div class="ui red button delete-button" data-type="form" data-form="#delete-form">
+ <button class="ui red button delete-button" data-type="form" data-form="#delete-form">
{{.locale.Tr "org.settings.confirm_delete_account"}}
- </div>
+ </button>
</form>
</div>
</div>
diff --git a/templates/org/settings/labels.tmpl b/templates/org/settings/labels.tmpl
index 5436bcba05..e04b391271 100644
--- a/templates/org/settings/labels.tmpl
+++ b/templates/org/settings/labels.tmpl
@@ -11,7 +11,7 @@
</div>
<div class="right floated three wide column">
<div class="ui right">
- <div class="ui green new-label button">{{.locale.Tr "repo.issues.new_label"}}</div>
+ <button class="ui green new-label button">{{.locale.Tr "repo.issues.new_label"}}</button>
</div>
</div>
</div>
diff --git a/templates/package/settings.tmpl b/templates/package/settings.tmpl
index dc12fb8207..875bf852bb 100644
--- a/templates/package/settings.tmpl
+++ b/templates/package/settings.tmpl
@@ -57,10 +57,7 @@
<form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" name="action" value="delete">
- <div class="text right actions">
- <div class="ui cancel button">{{.locale.Tr "cancel"}}</div>
- <button class="ui red button">{{.locale.Tr "ok"}}</button>
- </div>
+ {{template "base/delete_modal_actions" .}}
</form>
</div>
</div>
diff --git a/templates/projects/list.tmpl b/templates/projects/list.tmpl
index 4a21c0fd28..89c52dee68 100644
--- a/templates/projects/list.tmpl
+++ b/templates/projects/list.tmpl
@@ -84,15 +84,6 @@
<div class="content">
<p>{{.locale.Tr "repo.projects.deletion_desc"}}</p>
</div>
- <div class="actions">
- <div class="ui red basic inverted cancel button">
- <i class="remove icon"></i>
- {{.locale.Tr "modal.no"}}
- </div>
- <div class="ui green basic inverted ok button">
- <i class="checkmark icon"></i>
- {{.locale.Tr "modal.yes"}}
- </div>
- </div>
+ {{template "base/delete_modal_actions" .}}
</div>
{{end}}
diff --git a/templates/projects/view.tmpl b/templates/projects/view.tmpl
index 6867309510..b776f89efa 100644
--- a/templates/projects/view.tmpl
+++ b/templates/projects/view.tmpl
@@ -29,7 +29,7 @@
</div>
<div class="text right actions">
- <div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
<button data-url="{{$.Link}}" class="ui primary button" id="new_board_submit">{{$.locale.Tr "repo.projects.column.new_submit"}}</button>
</div>
</form>
@@ -127,7 +127,7 @@
</div>
<div class="text right actions">
- <div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
<button data-url="{{$.Link}}/{{.ID}}" class="ui primary button edit-column-button">{{$.locale.Tr "repo.projects.column.edit"}}</button>
</div>
</form>
@@ -144,7 +144,7 @@
</label>
</div>
<div class="text right actions">
- <div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
<button class="ui primary button set-default-project-board" data-url="{{$.Link}}/{{.ID}}/default">{{$.locale.Tr "repo.projects.column.set_default"}}</button>
</div>
</div>
@@ -158,8 +158,8 @@
{{$.locale.Tr "repo.projects.column.deletion_desc"}}
</label>
</div>
- <div class="text right actions">
- <div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
+ <div class="text right actions">{{/* TODO: convert to base/delete_modal_actions.tmpl */}}
+ <button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
<button class="ui red button delete-project-board" data-url="{{$.Link}}/{{.ID}}">{{$.locale.Tr "repo.projects.column.delete"}}</button>
</div>
</div>
@@ -265,15 +265,6 @@
<div class="content">
<p>{{.locale.Tr "repo.projects.deletion_desc"}}</p>
</div>
- <div class="actions">
- <div class="ui red basic inverted cancel button">
- <i class="remove icon"></i>
- {{.locale.Tr "modal.no"}}
- </div>
- <div class="ui green basic inverted ok button">
- <i class="checkmark icon"></i>
- {{.locale.Tr "modal.yes"}}
- </div>
- </div>
+ {{template "base/delete_modal_actions" .}}
</div>
{{end}}
diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl
index a093c19deb..7e8bf348a4 100644
--- a/templates/repo/branch/list.tmpl
+++ b/templates/repo/branch/list.tmpl
@@ -176,7 +176,7 @@
</div>
<div class="text right actions">
- <div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{.locale.Tr "settings.cancel"}}</button>
<button class="ui green button">{{.locale.Tr "repo.branch.confirm_create_branch"}}</button>
</div>
</form>
diff --git a/templates/repo/cite/cite_modal.tmpl b/templates/repo/cite/cite_modal.tmpl
index 185b34173d..f00bab8859 100644
--- a/templates/repo/cite/cite_modal.tmpl
+++ b/templates/repo/cite/cite_modal.tmpl
@@ -15,8 +15,8 @@
</div>
</div>
<div class="actions">
- <div class="ui black deny button">
+ <button class="ui black cancel button">
{{.locale.Tr "cancel"}}
- </div>
+ </button>
</div>
</div>
diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl
index f19a4d4223..ace5a41087 100644
--- a/templates/repo/commit_page.tmpl
+++ b/templates/repo/commit_page.tmpl
@@ -96,7 +96,7 @@
</div>
<div class="text right actions">
- <div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{.locale.Tr "settings.cancel"}}</button>
<button class="ui green button">{{.locale.Tr "repo.branch.confirm_create_branch"}}</button>
</div>
</form>
@@ -121,7 +121,7 @@
</div>
<div class="text right actions">
- <div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{.locale.Tr "settings.cancel"}}</button>
<button class="ui green button">{{.locale.Tr "repo.tag.confirm_create_tag"}}</button>
</div>
</form>
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index afd471368f..e0c58896f0 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -107,8 +107,8 @@
<div class="diff-file-header-actions gt-df gt-ac">
{{if $showFileViewToggle}}
<div class="ui compact icon buttons">
- <span class="ui tiny basic button tooltip file-view-toggle" data-toggle-selector="#diff-source-{{$file.NameHash}}" data-content="{{$.locale.Tr "repo.file_view_source"}}" data-position="bottom center">{{svg "octicon-code"}}</span>
- <span class="ui tiny basic button tooltip file-view-toggle active" data-toggle-selector="#diff-rendered-{{$file.NameHash}}" data-content="{{$.locale.Tr "repo.file_view_rendered"}}" data-position="bottom center">{{svg "octicon-file"}}</span>
+ <button class="ui tiny basic button tooltip file-view-toggle" data-toggle-selector="#diff-source-{{$file.NameHash}}" data-content="{{$.locale.Tr "repo.file_view_source"}}" data-position="bottom center">{{svg "octicon-code"}}</button>
+ <button class="ui tiny basic button tooltip file-view-toggle active" data-toggle-selector="#diff-rendered-{{$file.NameHash}}" data-content="{{$.locale.Tr "repo.file_view_rendered"}}" data-position="bottom center">{{svg "octicon-file"}}</button>
</div>
{{end}}
{{if $file.IsProtected}}
@@ -200,8 +200,8 @@
{{$.locale.Tr "loading"}}
</div>
<div class="text right edit buttons">
- <div class="ui basic primary cancel button" tabindex="3">{{.locale.Tr "repo.issues.cancel"}}</div>
- <div class="ui green save button" tabindex="2">{{.locale.Tr "repo.issues.save"}}</div>
+ <button class="ui basic primary cancel button" tabindex="3">{{.locale.Tr "repo.issues.cancel"}}</button>
+ <button class="ui green save button" tabindex="2">{{.locale.Tr "repo.issues.save"}}</button>
</div>
</div>
</div>
diff --git a/templates/repo/editor/edit.tmpl b/templates/repo/editor/edit.tmpl
index 992ccee8e4..431033e18e 100644
--- a/templates/repo/editor/edit.tmpl
+++ b/templates/repo/editor/edit.tmpl
@@ -65,14 +65,14 @@
<p>{{.locale.Tr "repo.editor.commit_empty_file_text"}}</p>
</div>
<div class="actions">
- <div class="ui red basic cancel inverted button">
+ <button class="ui red basic cancel inverted button">
<i class="remove icon"></i>
{{.locale.Tr "repo.editor.cancel"}}
- </div>
- <div class="ui green basic ok inverted button">
+ </button>
+ <button class="ui green basic ok inverted button">
<i class="save icon"></i>
{{.locale.Tr "repo.editor.commit_changes"}}
- </div>
+ </button>
</div>
</div>
diff --git a/templates/repo/editor/patch.tmpl b/templates/repo/editor/patch.tmpl
index bbd5c2dbde..75a8b5d687 100644
--- a/templates/repo/editor/patch.tmpl
+++ b/templates/repo/editor/patch.tmpl
@@ -45,14 +45,14 @@
<p>{{.locale.Tr "repo.editor.commit_empty_file_text"}}</p>
</div>
<div class="actions">
- <div class="ui red basic cancel inverted button">
- <i class="remove icon"></i>
+ <button class="ui red basic inverted cancel button">
+ {{svg "octicon-x"}}
{{.locale.Tr "repo.editor.cancel"}}
- </div>
- <div class="ui green basic ok inverted button">
- <i class="save icon"></i>
+ </button>
+ <button class="ui green basic inverted ok button">
+ {{svg "fontawesome-save"}}
{{.locale.Tr "repo.editor.commit_changes"}}
- </div>
+ </button>
</div>
</div>
</div>
diff --git a/templates/repo/issue/labels.tmpl b/templates/repo/issue/labels.tmpl
index 82cfcd0712..0a25d9c87f 100644
--- a/templates/repo/issue/labels.tmpl
+++ b/templates/repo/issue/labels.tmpl
@@ -6,7 +6,7 @@
{{template "repo/issue/navbar" .}}
{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}}
<div class="ui right">
- <div class="ui green new-label button">{{.locale.Tr "repo.issues.new_label"}}</div>
+ <button class="ui green new-label button">{{.locale.Tr "repo.issues.new_label"}}</button>
</div>
{{end}}
</div>
diff --git a/templates/repo/issue/labels/edit_delete_label.tmpl b/templates/repo/issue/labels/edit_delete_label.tmpl
index 450061e835..38a948172f 100644
--- a/templates/repo/issue/labels/edit_delete_label.tmpl
+++ b/templates/repo/issue/labels/edit_delete_label.tmpl
@@ -6,16 +6,7 @@
<div class="content">
<p>{{.locale.Tr "repo.issues.label_deletion_desc"}}</p>
</div>
- <div class="actions">
- <div class="ui red basic inverted cancel button">
- <i class="remove icon"></i>
- {{.locale.Tr "modal.no"}}
- </div>
- <div class="ui green basic inverted ok button">
- <i class="checkmark icon"></i>
- {{.locale.Tr "modal.yes"}}
- </div>
- </div>
+ {{template "base/delete_modal_actions" .}}
</div>
<div class="ui small edit-label modal">
@@ -61,11 +52,13 @@
</form>
</div>
<div class="actions">
- <div class="ui secondary small basic cancel button">
+ <button class="ui secondary small basic cancel button">
+ {{svg "octicon-x"}}
{{.locale.Tr "cancel"}}
- </div>
- <div class="ui primary small approve button">
+ </button>
+ <button class="ui primary small approve button">
+ <i class="save icon"></i>
{{.locale.Tr "save"}}
- </div>
+ </button>
</div>
</div>
diff --git a/templates/repo/issue/labels/label_new.tmpl b/templates/repo/issue/labels/label_new.tmpl
index 62f7155b74..c937f28e8a 100644
--- a/templates/repo/issue/labels/label_new.tmpl
+++ b/templates/repo/issue/labels/label_new.tmpl
@@ -36,12 +36,15 @@
</div>
</form>
</div>
+
<div class="actions">
- <div class="ui secondary small basic cancel button">
+ <button class="ui red basic inverted cancel button">
+ {{svg "octicon-x"}}
{{.locale.Tr "cancel"}}
- </div>
- <div class="ui primary small approve button">
+ </button>
+ <button class="ui green basic inverted ok button">
+ {{svg "octicon-check"}}
{{.locale.Tr "repo.issues.create_label"}}
- </div>
+ </button>
</div>
</div>
diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl
index ca05264e77..36faf86113 100644
--- a/templates/repo/issue/list.tmpl
+++ b/templates/repo/issue/list.tmpl
@@ -213,9 +213,9 @@
{{if not .Repository.IsArchived}}
<!-- Action Button -->
{{if .IsShowClosed}}
- <div class="ui green active basic button issue-action" data-action="open" data-url="{{$.RepoLink}}/issues/status" style="margin-left: auto">{{.locale.Tr "repo.issues.action_open"}}</div>
+ <button class="ui green active basic button issue-action" data-action="open" data-url="{{$.RepoLink}}/issues/status" style="margin-left: auto">{{.locale.Tr "repo.issues.action_open"}}</button>
{{else}}
- <div class="ui red active basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status" style="margin-left: auto">{{.locale.Tr "repo.issues.action_close"}}</div>
+ <button class="ui red active basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status" style="margin-left: auto">{{.locale.Tr "repo.issues.action_close"}}</button>
{{end}}
<!-- Labels -->
<div class="ui {{if not .Labels}}disabled{{end}} dropdown jump item">
diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl
index 2918c4359f..b4f036d32a 100644
--- a/templates/repo/issue/milestone_issues.tmpl
+++ b/templates/repo/issue/milestone_issues.tmpl
@@ -149,9 +149,9 @@
<div class="ui secondary filter stackable menu">
<!-- Action Button -->
{{if .IsShowClosed}}
- <div class="ui green active basic button issue-action" data-action="open" data-url="{{$.RepoLink}}/issues/status" style="margin-left: auto">{{.locale.Tr "repo.issues.action_open"}}</div>
+ <button class="ui green active basic button issue-action" data-action="open" data-url="{{$.RepoLink}}/issues/status" style="margin-left: auto">{{.locale.Tr "repo.issues.action_open"}}</button>
{{else}}
- <div class="ui red active basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status" style="margin-left: auto">{{.locale.Tr "repo.issues.action_close"}}</div>
+ <button class="ui red active basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status" style="margin-left: auto">{{.locale.Tr "repo.issues.action_close"}}</button>
{{end}}
<!-- Labels -->
<div class="ui {{if not .Labels}}disabled{{end}} dropdown jump item">
diff --git a/templates/repo/issue/milestones.tmpl b/templates/repo/issue/milestones.tmpl
index 3730d3d3c4..5797b358f7 100644
--- a/templates/repo/issue/milestones.tmpl
+++ b/templates/repo/issue/milestones.tmpl
@@ -124,16 +124,7 @@
<div class="content">
<p>{{.locale.Tr "repo.milestones.deletion_desc"}}</p>
</div>
- <div class="actions">
- <div class="ui red basic inverted cancel button">
- <i class="remove icon"></i>
- {{.locale.Tr "modal.no"}}
- </div>
- <div class="ui green basic inverted ok button">
- <i class="checkmark icon"></i>
- {{.locale.Tr "modal.yes"}}
- </div>
- </div>
+ {{template "base/delete_modal_actions" .}}
</div>
{{end}}
{{template "base/footer" .}}
diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl
index 6aec6e3157..f013317ca8 100644
--- a/templates/repo/issue/view_content.tmpl
+++ b/templates/repo/issue/view_content.tmpl
@@ -112,13 +112,13 @@
<div class="text right">
{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .DisableStatusChange)}}
{{if .Issue.IsClosed}}
- <div id="status-button" class="ui green basic button" tabindex="6" data-status="{{.locale.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{.locale.Tr "repo.issues.reopen_comment_issue"}}" data-status-val="reopen">
+ <button id="status-button" class="ui green basic button" tabindex="6" data-status="{{.locale.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{.locale.Tr "repo.issues.reopen_comment_issue"}}" data-status-val="reopen">
{{.locale.Tr "repo.issues.reopen_issue"}}
- </div>
+ </button>
{{else}}
- <div id="status-button" class="ui red basic button" tabindex="6" data-status="{{.locale.Tr "repo.issues.close_issue"}}" data-status-and-comment="{{.locale.Tr "repo.issues.close_comment_issue"}}" data-status-val="close">
+ <button id="status-button" class="ui red basic button" tabindex="6" data-status="{{.locale.Tr "repo.issues.close_issue"}}" data-status-and-comment="{{.locale.Tr "repo.issues.close_comment_issue"}}" data-status-val="close">
{{.locale.Tr "repo.issues.close_issue"}}
- </div>
+ </button>
{{end}}
{{end}}
<button class="ui green button loading-button" tabindex="5">
@@ -163,13 +163,13 @@
<div class="text right">
{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .DisableStatusChange)}}
{{if .Issue.IsClosed}}
- <div id="status-button" class="ui green basic button" tabindex="6" data-status="{{.locale.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{.locale.Tr "repo.issues.reopen_comment_issue"}}" data-status-val="reopen">
+ <button id="status-button" class="ui green basic button" tabindex="6" data-status="{{.locale.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{.locale.Tr "repo.issues.reopen_comment_issue"}}" data-status-val="reopen">
{{.locale.Tr "repo.issues.reopen_issue"}}
- </div>
+ </button>
{{else}}
- <div id="status-button" class="ui red basic button" tabindex="6" data-status="{{.locale.Tr "repo.issues.close_issue"}}" data-status-and-comment="{{.locale.Tr "repo.issues.close_comment_issue"}}" data-status-val="close">
+ <button id="status-button" class="ui red basic button" tabindex="6" data-status="{{.locale.Tr "repo.issues.close_issue"}}" data-status-and-comment="{{.locale.Tr "repo.issues.close_comment_issue"}}" data-status-val="close">
{{.locale.Tr "repo.issues.close_issue"}}
- </div>
+ </button>
{{end}}
{{end}}
<button class="ui green button loading-button" tabindex="5">
@@ -215,8 +215,8 @@
{{end}}
<div class="field footer">
<div class="text right edit">
- <div class="ui basic secondary cancel button" tabindex="3">{{.locale.Tr "repo.issues.cancel"}}</div>
- <div class="ui primary save button" tabindex="2">{{.locale.Tr "repo.issues.save"}}</div>
+ <button class="ui basic secondary cancel button" tabindex="3">{{.locale.Tr "repo.issues.cancel"}}</button>
+ <button class="ui primary save button" tabindex="2">{{.locale.Tr "repo.issues.save"}}</button>
</div>
</div>
</div>
diff --git a/templates/repo/issue/view_content/comments_delete_time.tmpl b/templates/repo/issue/view_content/comments_delete_time.tmpl
index bc08d7fde7..b79b7ae2be 100644
--- a/templates/repo/issue/view_content/comments_delete_time.tmpl
+++ b/templates/repo/issue/view_content/comments_delete_time.tmpl
@@ -7,10 +7,7 @@
{{.ctxData.CsrfTokenHtml}}
</form>
<div class="header">{{.ctxData.locale.Tr "repo.issues.del_time"}}</div>
- <div class="actions">
- <div class="ui red approve button">{{.ctxData.locale.Tr "repo.issues.context.delete"}}</div>
- <div class="ui cancel button">{{.ctxData.locale.Tr "repo.issues.add_time_cancel"}}</div>
- </div>
+ {{template "base/delete_modal_actions" .}}
</div>
<button class="ui icon button compact mini issue-delete-time tooltip" data-id="{{.comment.Time.ID}}" data-content="{{.ctxData.locale.Tr "repo.issues.del_time"}}" data-position="top right">
{{svg "octicon-trash"}}
diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl
index f0bf23c9e9..30345b0138 100644
--- a/templates/repo/issue/view_content/pull.tmpl
+++ b/templates/repo/issue/view_content/pull.tmpl
@@ -58,7 +58,7 @@
<input id="message" name="message">
</div>
<div class="text right actions">
- <div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
<button class="ui red button" type="submit">{{$.locale.Tr "ok"}}</button>
</div>
</form>
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index e58f94aff3..165dca7e0c 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -346,8 +346,8 @@
</form>
</div>
<div class="actions">
- <div class="ui green approve button">{{.locale.Tr "repo.issues.add_time_short"}}</div>
- <div class="ui red cancel button">{{.locale.Tr "repo.issues.add_time_cancel"}}</div>
+ <button class="ui green approve button">{{.locale.Tr "repo.issues.add_time_short"}}</button>
+ <button class="ui red cancel button">{{.locale.Tr "repo.issues.add_time_cancel"}}</button>
</div>
</div>
<button class="ui fluid button green tooltip issue-add-time gt-mt-3" data-content='{{.locale.Tr "repo.issues.add_time"}}' data-position="top center">{{.locale.Tr "repo.issues.add_time_short"}}</button>
@@ -532,14 +532,14 @@
{{end}}</p>
</div>
<div class="actions">
- <div class="ui red cancel inverted button">
+ <button class="ui red cancel inverted button">
{{svg "octicon-x"}}
{{.locale.Tr "repo.issues.dependency.cancel"}}
- </div>
- <div class="ui green ok inverted button">
+ </button>
+ <button class="ui green ok inverted button">
{{svg "octicon-check"}}
{{.locale.Tr "repo.issues.dependency.remove"}}
- </div>
+ </button>
</div>
</div>
{{end}}
@@ -619,7 +619,7 @@
{{end}}
<div class="text right actions">
- <div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{.locale.Tr "settings.cancel"}}</button>
<button class="ui red button">
{{if .Issue.IsLocked}}
{{.locale.Tr "repo.issues.unlock_confirm"}}
@@ -655,7 +655,7 @@
<form action="{{.Issue.Link}}/delete" method="post">
{{.CsrfTokenHtml}}
<div class="center actions">
- <div class="ui basic cancel inverted button">{{.locale.Tr "settings.cancel"}}</div>
+ <button class="ui basic cancel inverted button">{{.locale.Tr "settings.cancel"}}</button>
<button class="ui basic red inverted button">{{.locale.Tr "modal.yes"}}</button>
</div>
</form>
diff --git a/templates/repo/issue/view_content/update_branch_by_merge.tmpl b/templates/repo/issue/view_content/update_branch_by_merge.tmpl
index 6d36a9b45f..49e4467dc3 100644
--- a/templates/repo/issue/view_content/update_branch_by_merge.tmpl
+++ b/templates/repo/issue/view_content/update_branch_by_merge.tmpl
@@ -19,8 +19,8 @@
<div class="ui dropdown icon button no-text">
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
- <div class="item active selected" data-do="{{.Link}}/update">{{$.locale.Tr "repo.pulls.update_branch"}}</div>
- <div class="item" data-do="{{.Link}}/update?style=rebase">{{$.locale.Tr "repo.pulls.update_branch_rebase"}}</div>
+ <a class="item active selected" data-do="{{.Link}}/update">{{$.locale.Tr "repo.pulls.update_branch"}}</a>
+ <a class="item" data-do="{{.Link}}/update?style=rebase">{{$.locale.Tr "repo.pulls.update_branch_rebase"}}</a>
</div>
</div>
</div>
diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl
index f0ac1e021e..2a8381b0b4 100644
--- a/templates/repo/issue/view_title.tmpl
+++ b/templates/repo/issue/view_title.tmpl
@@ -1,9 +1,7 @@
<div class="sixteen wide column title">
<div class="issue-title" id="issue-title-wrapper">
{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .Repository.IsArchived)}}
- <div class="edit-button">
- <button id="edit-title" class="ui basic button secondary not-in-edit">{{.locale.Tr "repo.issues.edit"}}</button>
- </div>
+ <button id="edit-title" class="ui basic button secondary edit-button not-in-edit">{{.locale.Tr "repo.issues.edit"}}</button>
{{end}}
<h1>
<span id="issue-title">{{RenderIssueTitle $.Context .Issue.Title $.RepoLink $.Repository.ComposeMetas | RenderCodeBlock}}</span>
diff --git a/templates/repo/migrate/migrating.tmpl b/templates/repo/migrate/migrating.tmpl
index a3552610c4..cd3c5e754e 100644
--- a/templates/repo/migrate/migrating.tmpl
+++ b/templates/repo/migrate/migrating.tmpl
@@ -72,7 +72,7 @@
</div>
<div class="text right actions">
- <div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{.locale.Tr "settings.cancel"}}</button>
<button class="ui red button">{{.locale.Tr "repo.settings.confirm_delete"}}</button>
</div>
</form>
diff --git a/templates/repo/projects/list.tmpl b/templates/repo/projects/list.tmpl
index f066f84ea2..6833b7d785 100644
--- a/templates/repo/projects/list.tmpl
+++ b/templates/repo/projects/list.tmpl
@@ -86,16 +86,7 @@
<div class="content">
<p>{{.locale.Tr "repo.projects.deletion_desc"}}</p>
</div>
- <div class="actions">
- <div class="ui red basic inverted cancel button">
- <i class="remove icon"></i>
- {{.locale.Tr "modal.no"}}
- </div>
- <div class="ui green basic inverted ok button">
- <i class="checkmark icon"></i>
- {{.locale.Tr "modal.yes"}}
- </div>
- </div>
+ {{template "base/delete_modal_actions" .}}
</div>
{{end}}
{{template "base/footer" .}}
diff --git a/templates/repo/projects/view.tmpl b/templates/repo/projects/view.tmpl
index bef9cb9bf0..0248b9c6d2 100644
--- a/templates/repo/projects/view.tmpl
+++ b/templates/repo/projects/view.tmpl
@@ -33,7 +33,7 @@
</div>
<div class="text right actions">
- <div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
<button data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}" class="ui primary button" id="new_board_submit">{{$.locale.Tr "repo.projects.column.new_submit"}}</button>
</div>
</form>
@@ -131,7 +131,7 @@
</div>
<div class="text right actions">
- <div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
<button data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}/{{.ID}}" class="ui primary button">{{$.locale.Tr "repo.projects.column.edit"}}</button>
</div>
</form>
@@ -148,7 +148,7 @@
</label>
</div>
<div class="text right actions">
- <div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
<button class="ui primary button set-default-project-board" data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}/{{.ID}}/default">{{$.locale.Tr "repo.projects.column.set_default"}}</button>
</div>
</div>
@@ -162,8 +162,8 @@
{{$.locale.Tr "repo.projects.column.deletion_desc"}}
</label>
</div>
- <div class="text right actions">
- <div class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</div>
+ <div class="text right actions">{{/* TODO: Convert to base/delete_modal_actions.tmpl? */}}
+ <button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
<button class="ui red button delete-project-board" data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}/{{.ID}}">{{$.locale.Tr "repo.projects.column.delete"}}</button>
</div>
</div>
@@ -276,16 +276,7 @@
<div class="content">
<p>{{.locale.Tr "repo.projects.deletion_desc"}}</p>
</div>
- <div class="actions">
- <div class="ui red basic inverted cancel button">
- <i class="remove icon"></i>
- {{.locale.Tr "modal.no"}}
- </div>
- <div class="ui green basic inverted ok button">
- <i class="checkmark icon"></i>
- {{.locale.Tr "modal.yes"}}
- </div>
- </div>
+ {{template "base/delete_modal_actions" .}}
</div>
{{end}}
diff --git a/templates/repo/release/new.tmpl b/templates/repo/release/new.tmpl
index d7c580fed9..8c4df98d19 100644
--- a/templates/repo/release/new.tmpl
+++ b/templates/repo/release/new.tmpl
@@ -114,7 +114,7 @@
{{$.locale.Tr "repo.release.delete_release"}}
</a>
{{if .IsDraft}}
- <input class="ui button" type="submit" name="draft" value="{{.locale.Tr "repo.release.save_draft"}}"/>
+ <button class="ui button" type="submit" name="draft" value="{{.locale.Tr "repo.release.save_draft"}}">{{.locale.Tr "repo.release.save_draft"}}</button>
<button class="ui primary button">
{{.locale.Tr "repo.release.publish"}}
</button>
@@ -125,9 +125,9 @@
{{end}}
{{else}}
{{if not .tag_name}}
- <input class="ui grey button" type="submit" name="tag_only" value="{{.locale.Tr "repo.release.add_tag"}}"/>
+ <button class="ui grey button" type="submit" name="tag_only" value="{{.locale.Tr "repo.release.add_tag"}}">{{.locale.Tr "repo.release.add_tag"}}</button>
{{end}}
- <input class="ui button" type="submit" name="draft" value="{{.locale.Tr "repo.release.save_draft"}}"/>
+ <button class="ui button" type="submit" name="draft" value="{{.locale.Tr "repo.release.save_draft"}}">{{.locale.Tr "repo.release.save_draft"}}</button>
<button class="ui primary button">
{{.locale.Tr "repo.release.publish"}}
</button>
diff --git a/templates/repo/settings/deploy_keys.tmpl b/templates/repo/settings/deploy_keys.tmpl
index 22fddeb4df..ea4fba240e 100644
--- a/templates/repo/settings/deploy_keys.tmpl
+++ b/templates/repo/settings/deploy_keys.tmpl
@@ -8,9 +8,9 @@
{{.locale.Tr "repo.settings.deploy_keys"}}
<div class="ui right">
{{if not .DisableSSH}}
- <div class="ui primary tiny show-panel button" data-panel="#add-deploy-key-panel">{{.locale.Tr "repo.settings.add_deploy_key"}}</div>
+ <button class="ui primary tiny show-panel button" data-panel="#add-deploy-key-panel">{{.locale.Tr "repo.settings.add_deploy_key"}}</button>
{{else}}
- <div class="ui primary tiny button disabled">{{.locale.Tr "settings.ssh_disabled"}}</div>
+ <button class="ui primary tiny button disabled">{{.locale.Tr "settings.ssh_disabled"}}</button>
{{end}}
</div>
</h4>
@@ -85,15 +85,6 @@
<div class="content">
<p>{{.locale.Tr "repo.settings.deploy_key_deletion_desc"}}</p>
</div>
- <div class="actions">
- <div class="ui red basic inverted cancel button">
- <i class="remove icon"></i>
- {{.locale.Tr "modal.no"}}
- </div>
- <div class="ui green basic inverted ok button">
- <i class="checkmark icon"></i>
- {{.locale.Tr "modal.yes"}}
- </div>
- </div>
+ {{template "base/delete_modal_actions" .}}
</div>
{{template "base/footer" .}}
diff --git a/templates/repo/settings/lfs.tmpl b/templates/repo/settings/lfs.tmpl
index 566a701efb..9a38d32345 100644
--- a/templates/repo/settings/lfs.tmpl
+++ b/templates/repo/settings/lfs.tmpl
@@ -50,8 +50,8 @@
</p>
<form class="ui form" action="{{$.Link}}/delete/{{.Oid}}" method="post">
{{$.CsrfTokenHtml}}
- <div class="center actions">
- <div class="ui basic cancel inverted button">{{$.locale.Tr "settings.cancel"}}</div>
+ <div class="center actions">{{/* TODO: Convert to base/delete_modal_actions */}}
+ <button class="ui basic cancel inverted button">{{$.locale.Tr "settings.cancel"}}</button>
<button class="ui basic inverted yellow button">{{$.locale.Tr "modal.yes"}}</button>
</div>
</form>
diff --git a/templates/repo/settings/lfs_pointers.tmpl b/templates/repo/settings/lfs_pointers.tmpl
index 8eebc6e870..67021ba6cd 100644
--- a/templates/repo/settings/lfs_pointers.tmpl
+++ b/templates/repo/settings/lfs_pointers.tmpl
@@ -49,9 +49,9 @@
{{ShortSha .Oid}}
</a>
{{else}}
- <span class="ui detail icon button brown disabled truncate">
+ <button class="ui detail icon button brown disabled truncate">
{{ShortSha .Oid}}
- </span>
+ </button>
{{end}}
</span>
</td>
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index 030c77b881..be07aeb0ff 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -825,7 +825,7 @@
</div>
<div class="text right actions">
- <div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{.locale.Tr "settings.cancel"}}</button>
<button class="ui red button">{{.locale.Tr "repo.settings.convert_confirm"}}</button>
</div>
</form>
@@ -856,7 +856,7 @@
</div>
<div class="text right actions">
- <div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{.locale.Tr "settings.cancel"}}</button>
<button class="ui red button">{{.locale.Tr "repo.settings.convert_fork_confirm"}}</button>
</div>
</form>
@@ -892,7 +892,7 @@
</div>
<div class="text right actions">
- <div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{.locale.Tr "settings.cancel"}}</button>
<button class="ui red button">{{.locale.Tr "repo.settings.transfer_perform"}}</button>
</div>
</form>
@@ -926,7 +926,7 @@
</div>
<div class="text right actions">
- <div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{.locale.Tr "settings.cancel"}}</button>
<button class="ui red button">{{.locale.Tr "repo.settings.confirm_delete"}}</button>
</div>
</form>
@@ -958,7 +958,7 @@
</div>
<div class="text right actions">
- <div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
+ <button class="ui cancel button">{{.locale.Tr "settings.cancel"}}</button>
<button class="ui red button">{{.locale.Tr "repo.settings.confirm_wiki_delete"}}</button>
</div>
</form>
@@ -988,10 +988,7 @@
{{.CsrfTokenHtml}}
<input type="hidden" name="action" value="{{if .Repository.IsArchived}}unarchive{{else}}archive{{end}}">
<input type="hidden" name="repo_id" value="{{.Repository.ID}}">
- <div class="center actions">
- <div class="ui basic cancel inverted button">{{.locale.Tr "settings.cancel"}}</div>
- <button class="ui basic inverted yellow button">{{.locale.Tr "modal.yes"}}</button>
- </div>
+ {{template "base/delete_modal_actions" .}}
</form>
</div>
{{end}}
diff --git a/templates/repo/settings/webhook/delete_modal.tmpl b/templates/repo/settings/webhook/delete_modal.tmpl
index fdc49ada4e..f455899663 100644
--- a/templates/repo/settings/webhook/delete_modal.tmpl
+++ b/templates/repo/settings/webhook/delete_modal.tmpl
@@ -6,14 +6,5 @@
<div class="content">
<p>{{.locale.Tr "repo.settings.webhook_deletion_desc"}}</p>
</div>
- <div class="actions">
- <div class="ui red basic inverted cancel button">
- <i class="remove icon"></i>
- {{.locale.Tr "modal.no"}}
- </div>
- <div class="ui green basic inverted ok button">
- <i class="checkmark icon"></i>
- {{.locale.Tr "modal.yes"}}
- </div>
- </div>
+ {{template "base/delete_modal_actions" .}}
</div>
diff --git a/templates/repo/unicode_escape_prompt.tmpl b/templates/repo/unicode_escape_prompt.tmpl
index d55bd0150a..12eff6aebe 100644
--- a/templates/repo/unicode_escape_prompt.tmpl
+++ b/templates/repo/unicode_escape_prompt.tmpl
@@ -1,7 +1,7 @@
{{if .EscapeStatus}}
{{if .EscapeStatus.HasInvisible}}
<div class="ui error message unicode-escape-prompt gt-tl">
- <span class="close icon hide-panel button" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</span>
+ <button class="close icon hide-panel button" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</button>
<div class="header">
{{$.root.locale.Tr "repo.invisible_runes_header"}}
</div>
@@ -12,7 +12,7 @@
</div>
{{else if .EscapeStatus.HasAmbiguous}}
<div class="ui warning message unicode-escape-prompt gt-tl">
- <span class="close icon hide-panel button" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</span>
+ <button class="close icon hide-panel button" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</button>
<div class="header">
{{$.root.locale.Tr "repo.ambiguous_runes_header"}}
</div>
diff --git a/templates/shared/actions/runner_list.tmpl b/templates/shared/actions/runner_list.tmpl
index eabddbb30c..30c52c01b4 100644
--- a/templates/shared/actions/runner_list.tmpl
+++ b/templates/shared/actions/runner_list.tmpl
@@ -20,9 +20,9 @@
</div>
<div class="ui input">
<input type="text" value="{{.RegistrationToken}}">
- <div class="ui basic label button" data-clipboard-text="{{.RegistrationToken}}">
+ <button class="ui basic label button" aria-label="{{.locale.Tr "copy"}}" data-clipboard-text="{{.RegistrationToken}}">
{{svg "octicon-copy" 14}}
- </div>
+ </button>
</div>
<div class="divider"></div>
<div class="item">
diff --git a/templates/shared/secrets/add_list.tmpl b/templates/shared/secrets/add_list.tmpl
index 9105b7ad9b..4aa5f0ccd5 100644
--- a/templates/shared/secrets/add_list.tmpl
+++ b/templates/shared/secrets/add_list.tmpl
@@ -1,7 +1,7 @@
<h4 class="ui top attached header">
{{.locale.Tr "secrets.secrets"}}
<div class="ui right">
- <div class="ui primary tiny show-panel button" data-panel="#add-secret-panel">{{.locale.Tr "secrets.creation"}}</div>
+ <button class="ui primary tiny show-panel button" data-panel="#add-secret-panel">{{.locale.Tr "secrets.creation"}}</button>
</div>
</h4>
<div class="ui attached segment">
diff --git a/templates/user/auth/grant.tmpl b/templates/user/auth/grant.tmpl
index c906db3e0a..060b675273 100644
--- a/templates/user/auth/grant.tmpl
+++ b/templates/user/auth/grant.tmpl
@@ -23,7 +23,7 @@
<input type="hidden" name="scope" value="{{.Scope}}">
<input type="hidden" name="nonce" value="{{.Nonce}}">
<input type="hidden" name="redirect_uri" value="{{.RedirectURI}}">
- <input type="submit" id="authorize-app" value="{{.locale.Tr "auth.authorize_application"}}" class="ui red inline button"/>
+ <button type="submit" id="authorize-app" value="{{.locale.Tr "auth.authorize_application"}}" class="ui red inline button">{{.locale.Tr "auth.authorize_application"}}</button>
<a href="{{.RedirectURI}}" class="ui basic primary inline button">Cancel</a>
</form>
</div>
diff --git a/templates/user/auth/webauthn_error.tmpl b/templates/user/auth/webauthn_error.tmpl
index 447d289a28..b6467de1aa 100644
--- a/templates/user/auth/webauthn_error.tmpl
+++ b/templates/user/auth/webauthn_error.tmpl
@@ -17,6 +17,6 @@
</div>
<div class="actions">
<button onclick="window.location.reload()" class="success ui button gt-hidden webauthn_error_timeout">{{.locale.Tr "webauthn_reload"}}</button>
- <div class="ui cancel button">{{.locale.Tr "cancel"}}</div>
+ <button class="ui cancel button">{{.locale.Tr "cancel"}}</button>
</div>
</div>
diff --git a/templates/user/settings/account.tmpl b/templates/user/settings/account.tmpl
index 9a57bd5722..53f7d021e0 100644
--- a/templates/user/settings/account.tmpl
+++ b/templates/user/settings/account.tmpl
@@ -151,9 +151,9 @@
<input id="password-confirmation" name="password" type="password" autocomplete="off" required>
</div>
<div class="field">
- <div class="ui red button delete-button" data-modal-id="delete-account" data-type="form" data-form="#delete-form">
+ <button class="ui red button delete-button" data-modal-id="delete-account" data-type="form" data-form="#delete-form">
{{.locale.Tr "settings.confirm_delete_account"}}
- </div>
+ </button>
<a href="{{AppSubUrl}}/user/forgot_password?email={{.Email}}">{{.locale.Tr "auth.forgot_password"}}</a>
</div>
</form>
diff --git a/templates/user/settings/applications.tmpl b/templates/user/settings/applications.tmpl
index b0cd37d44c..18132c4a75 100644
--- a/templates/user/settings/applications.tmpl
+++ b/templates/user/settings/applications.tmpl
@@ -276,15 +276,16 @@
<div class="content">
<p>{{.locale.Tr "settings.access_token_deletion_desc"}}</p>
</div>
- <div class="actions">
- <div class="ui cancel button">
- <i class="remove icon"></i>
+
+ <div class="actions">{{/* TODO: Convert to base/delete_modal_actions.tmpl */}}
+ <button class="ui green basic inverted cancel button">
+ {{svg "octicon-x"}}
{{.locale.Tr "settings.access_token_deletion_cancel_action"}}
- </div>
- <div class="ui red basic inverted ok button">
- <i class="checkmark icon"></i>
+ </button>
+ <button class="ui red basic inverted ok button">
+ {{svg "octicon-check"}}
{{.locale.Tr "settings.access_token_deletion_confirm_action"}}
- </div>
+ </button>
</div>
</div>
diff --git a/templates/user/settings/keys_gpg.tmpl b/templates/user/settings/keys_gpg.tmpl
index c80890940a..93ca12a088 100644
--- a/templates/user/settings/keys_gpg.tmpl
+++ b/templates/user/settings/keys_gpg.tmpl
@@ -1,7 +1,7 @@
<h4 class="ui top attached header">
{{.locale.Tr "settings.manage_gpg_keys"}}
<div class="ui right">
- <div class="ui primary tiny show-panel button" data-panel="#add-gpg-key-panel">{{.locale.Tr "settings.add_key"}}</div>
+ <button class="ui primary tiny show-panel button" data-panel="#add-gpg-key-panel">{{.locale.Tr "settings.add_key"}}</button>
</div>
</h4>
<div class="ui attached segment">
diff --git a/templates/user/settings/keys_principal.tmpl b/templates/user/settings/keys_principal.tmpl
index cc1152b739..8012b874cd 100644
--- a/templates/user/settings/keys_principal.tmpl
+++ b/templates/user/settings/keys_principal.tmpl
@@ -3,9 +3,9 @@
{{.locale.Tr "settings.manage_ssh_principals"}}
<div class="ui right">
{{if not .DisableSSH}}
- <div class="ui primary tiny show-panel button" data-panel="#add-ssh-principal-panel">{{.locale.Tr "settings.add_new_principal"}}</div>
+ <button class="ui primary tiny show-panel button" data-panel="#add-ssh-principal-panel">{{.locale.Tr "settings.add_new_principal"}}</button>
{{else}}
- <div class="ui primary tiny button disabled">{{.locale.Tr "settings.ssh_disabled"}}</div>
+ <button class="ui primary tiny button disabled">{{.locale.Tr "settings.ssh_disabled"}}</button>
{{end}}
</div>
</h4>
diff --git a/templates/user/settings/keys_ssh.tmpl b/templates/user/settings/keys_ssh.tmpl
index 891959d351..1ff4dab34e 100644
--- a/templates/user/settings/keys_ssh.tmpl
+++ b/templates/user/settings/keys_ssh.tmpl
@@ -2,11 +2,11 @@
{{.locale.Tr "settings.manage_ssh_keys"}}
<div class="ui right">
{{if not .DisableSSH}}
- <div id="add-ssh-button" class="ui primary tiny show-panel button" data-panel="#add-ssh-key-panel">
+ <button id="add-ssh-button" class="ui primary tiny show-panel button" data-panel="#add-ssh-key-panel">
{{.locale.Tr "settings.add_key"}}
- </div>
+ </button>
{{else}}
- <div class="ui primary tiny button disabled">{{.locale.Tr "settings.ssh_disabled"}}</div>
+ <button class="ui primary tiny button disabled">{{.locale.Tr "settings.ssh_disabled"}}</button>
{{end}}
</div>
</h4>
diff --git a/templates/user/settings/repos.tmpl b/templates/user/settings/repos.tmpl
index 902b3fb2f3..2e107ca7fa 100644
--- a/templates/user/settings/repos.tmpl
+++ b/templates/user/settings/repos.tmpl
@@ -50,16 +50,7 @@
{{$.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{$dir}}">
<input type="hidden" name="action" value="adopt">
- <div class="actions">
- <div class="ui red basic inverted cancel button">
- <i class="remove icon"></i>
- {{$.locale.Tr "modal.no"}}
- </div>
- <button class="ui green basic inverted ok button">
- <i class="checkmark icon"></i>
- {{$.locale.Tr "modal.yes"}}
- </button>
- </div>
+ {{template "base/delete_modal_actions" .}}
</form>
</div>
{{end}}
@@ -77,16 +68,7 @@
{{$.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{$dir}}">
<input type="hidden" name="action" value="delete">
- <div class="actions">
- <div class="ui red basic inverted cancel button">
- <i class="remove icon"></i>
- {{$.locale.Tr "modal.no"}}
- </div>
- <button class="ui green basic inverted ok button">
- <i class="checkmark icon"></i>
- {{$.locale.Tr "modal.yes"}}
- </button>
- </div>
+ {{template "base/delete_modal_actions" .}}
</form>
</div>
{{end}}
diff --git a/templates/user/settings/security/twofa.tmpl b/templates/user/settings/security/twofa.tmpl
index a4da947628..1a0a8a6432 100644
--- a/templates/user/settings/security/twofa.tmpl
+++ b/templates/user/settings/security/twofa.tmpl
@@ -13,7 +13,7 @@
<form class="ui form" action="{{AppSubUrl}}/user/settings/security/two_factor/disable" method="post" enctype="multipart/form-data" id="disable-form">
{{.CsrfTokenHtml}}
<p>{{.locale.Tr "settings.twofa_disable_note"}}</p>
- <div class="ui red button delete-button" data-modal-id="disable-twofa" data-type="form" data-form="#disable-form">{{$.locale.Tr "settings.twofa_disable"}}</div>
+ <button class="ui red button delete-button" data-modal-id="disable-twofa" data-type="form" data-form="#disable-form">{{$.locale.Tr "settings.twofa_disable"}}</button>
</form>
{{else}}
<p>{{.locale.Tr "settings.twofa_not_enrolled"}}</p>
diff --git a/web_src/js/features/admin/common.js b/web_src/js/features/admin/common.js
index d023e0bc36..be5aa876a5 100644
--- a/web_src/js/features/admin/common.js
+++ b/web_src/js/features/admin/common.js
@@ -198,7 +198,8 @@ export function initAdminCommon() {
break;
}
});
- $('#delete-selection').on('click', function () {
+ $('#delete-selection').on('click', function (e) {
+ e.preventDefault();
const $this = $(this);
$this.addClass('loading disabled');
const ids = [];
diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js
index 4fa6942467..0f36ce2bf8 100644
--- a/web_src/js/features/common-global.js
+++ b/web_src/js/features/common-global.js
@@ -202,7 +202,8 @@ export function initGlobalDropzone() {
}
export function initGlobalLinkActions() {
- function showDeletePopup() {
+ function showDeletePopup(e) {
+ e.preventDefault();
const $this = $(this);
const dataArray = $this.data();
let filter = '';
@@ -243,10 +244,10 @@ export function initGlobalLinkActions() {
});
}
}).modal('show');
- return false;
}
- function showAddAllPopup() {
+ function showAddAllPopup(e) {
+ e.preventDefault();
const $this = $(this);
let filter = '';
if ($this.attr('id')) {
@@ -272,7 +273,6 @@ export function initGlobalLinkActions() {
});
}
}).modal('show');
- return false;
}
function linkAction(e) {
@@ -318,13 +318,21 @@ export function initGlobalLinkActions() {
}
export function initGlobalButtons() {
- $('.show-panel.button').on('click', function () {
+ // There are many "cancel button" elements in modal dialogs, Fomantic UI expects they are button-like elements but never submit a form.
+ // However, Gitea misuses the modal dialog and put the cancel buttons inside forms, so we must prevent the form submission.
+ // There are a few cancel buttons in non-modal forms, and there are some dynamically created forms (eg: the "Edit Issue Content")
+ $(document).on('click', 'form .ui.cancel.button', (e) => {
+ e.preventDefault();
+ });
+
+ $('.show-panel.button').on('click', function (e) {
+ e.preventDefault();
showElem($(this).data('panel'));
});
- $('.hide-panel.button').on('click', function (event) {
+ $('.hide-panel.button').on('click', function (e) {
// a `.hide-panel.button` can hide a panel, by `data-panel="selector"` or `data-panel-closest="selector"`
- event.preventDefault();
+ e.preventDefault();
let sel = $(this).attr('data-panel');
if (sel) {
hideElem($(sel));
@@ -339,7 +347,8 @@ export function initGlobalButtons() {
alert('Nothing to hide');
});
- $('.show-modal').on('click', function () {
+ $('.show-modal').on('click', function (e) {
+ e.preventDefault();
const modalDiv = $($(this).attr('data-modal'));
for (const attrib of this.attributes) {
if (!attrib.name.startsWith('data-modal-')) {
@@ -360,7 +369,8 @@ export function initGlobalButtons() {
}
});
- $('.delete-post.button').on('click', function () {
+ $('.delete-post.button').on('click', function (e) {
+ e.preventDefault();
const $this = $(this);
$.post($this.attr('data-request-url'), {
_csrf: csrfToken
diff --git a/web_src/js/features/common-issue.js b/web_src/js/features/common-issue.js
index 0965caef15..ebc851d676 100644
--- a/web_src/js/features/common-issue.js
+++ b/web_src/js/features/common-issue.js
@@ -34,6 +34,7 @@ export function initCommonIssue() {
});
$('.issue-action').on('click', async function (e) {
+ e.preventDefault();
let action = this.getAttribute('data-action');
let elementId = this.getAttribute('data-element-id');
const url = this.getAttribute('data-url');
diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js
index 41c9dd118f..a8a27c2572 100644
--- a/web_src/js/features/repo-issue.js
+++ b/web_src/js/features/repo-issue.js
@@ -230,7 +230,8 @@ export function initRepoIssueStatusButton() {
const value = easyMDE?.value() || $(this).val();
$statusButton.text($statusButton.data(value.length === 0 ? 'status' : 'status-and-comment'));
});
- $statusButton.on('click', () => {
+ $statusButton.on('click', (e) => {
+ e.preventDefault();
$('#status').val($statusButton.data('status-val'));
$('#comment-form').trigger('submit');
});
diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js
index 70542ad883..5346a0d274 100644
--- a/web_src/js/features/repo-legacy.js
+++ b/web_src/js/features/repo-legacy.js
@@ -412,7 +412,8 @@ async function onEditContent(event) {
$saveButton.trigger('click');
});
- $editContentZone.find('.cancel.button').on('click', () => {
+ $editContentZone.find('.cancel.button').on('click', (e) => {
+ e.preventDefault();
showElem($renderContent);
hideElem($editContentZone);
if (dz) {
diff --git a/web_src/svg/fontawesome-save.svg b/web_src/svg/fontawesome-save.svg
new file mode 100644
index 0000000000..763d26abb1
--- /dev/null
+++ b/web_src/svg/fontawesome-save.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 448 512"><path d="m434 130-84-84a48 48 0 0 0-33.9-14H48A48 48 0 0 0 0 80v352a48 48 0 0 0 48 48h352a48 48 0 0 0 48-48V163.9a48 48 0 0 0-14-34zM224 416a64 64 0 1 1 0-128 64 64 0 0 1 0 128zm96-304.5V212a12 12 0 0 1-12 12H76a12 12 0 0 1-12-12V108a12 12 0 0 1 12-12h228.5a12 12 0 0 1 8.5 3.5l3.5 3.5a12 12 0 0 1 3.5 8.5z"/></svg> \ No newline at end of file