mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
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>
This commit is contained in:
@@ -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"}}
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user