fix: Gitea a11y fixes R1-R4 from audit #492
Some checks failed
Architecture Lint / Linter Tests (pull_request) Successful in 27s
Smoke Test / smoke (pull_request) Failing after 20s
Validate Config / YAML Lint (pull_request) Failing after 15s
Validate Config / JSON Validate (pull_request) Successful in 15s
Validate Config / Python Syntax & Import Check (pull_request) Failing after 1m8s
Validate Config / Python Test Suite (pull_request) Has been skipped
Validate Config / Shell Script Lint (pull_request) Failing after 43s
Validate Config / Cron Syntax Check (pull_request) Successful in 10s
Validate Config / Deploy Script Dry Run (pull_request) Successful in 11s
PR Checklist / pr-checklist (pull_request) Failing after 3m21s
Validate Config / Playbook Schema Validation (pull_request) Successful in 19s
Architecture Lint / Lint Repository (pull_request) Failing after 9s
Some checks failed
Architecture Lint / Linter Tests (pull_request) Successful in 27s
Smoke Test / smoke (pull_request) Failing after 20s
Validate Config / YAML Lint (pull_request) Failing after 15s
Validate Config / JSON Validate (pull_request) Successful in 15s
Validate Config / Python Syntax & Import Check (pull_request) Failing after 1m8s
Validate Config / Python Test Suite (pull_request) Has been skipped
Validate Config / Shell Script Lint (pull_request) Failing after 43s
Validate Config / Cron Syntax Check (pull_request) Successful in 10s
Validate Config / Deploy Script Dry Run (pull_request) Successful in 11s
PR Checklist / pr-checklist (pull_request) Failing after 3m21s
Validate Config / Playbook Schema Validation (pull_request) Successful in 19s
Architecture Lint / Lint Repository (pull_request) Failing after 9s
Deployable custom template overrides for WCAG 2.1 AA compliance. R1 (#551): Password visibility toggle on sign-in page - Eye icon button toggles type=password / type=text - Updates aria-label dynamically ("Show/Hide password") R2 (#552): aria-required on required form fields - aria-required="true" on username and password inputs - Screen readers now properly announce required state R3 (#553): aria-label on star/fork count links - aria-label="2 stars" / aria-label="0 forks" - Screen readers announce meaning, not just numbers R4 (#554): <time> elements for relative timestamps - <time datetime="ISO8601">2 minutes ago</time> - Machine-readable dates for screen readers and crawlers Closes #551, #552, #553, #554
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
{{/*
|
||||
Gitea a11y fix: R1 — Password visibility toggle + R2 — aria-required
|
||||
|
||||
Override of user/auth/signin_inner.tmpl
|
||||
Adds:
|
||||
- Eye icon toggle to show/hide password content
|
||||
- aria-required="true" on required fields
|
||||
- Proper label associations
|
||||
|
||||
Deploy to: custom/templates/user/auth/signin_inner.tmpl
|
||||
*/}}
|
||||
{{template "base/head" .}}
|
||||
<div class="page-content container">
|
||||
<div class="signin">
|
||||
<h1>{{.locale.Tr "sign_in"}}</h1>
|
||||
|
||||
<form action="{{AppSubUrl}}/user/login" method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
|
||||
{{/* a11y R2: aria-required on username field */}}
|
||||
<div class="field">
|
||||
<label for="user_name">{{.locale.Tr "username"}}</label>
|
||||
<input
|
||||
id="user_name"
|
||||
name="user_name"
|
||||
type="text"
|
||||
value="{{.user_name}}"
|
||||
autofocus
|
||||
required
|
||||
aria-required="true"
|
||||
autocomplete="username"
|
||||
placeholder="{{.locale.Tr "username"}}"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{{/* a11y R1: Password field with visibility toggle */}}
|
||||
<div class="field" style="position:relative">
|
||||
<label for="password">{{.locale.Tr "password"}}</label>
|
||||
<div style="display:flex;align-items:center;position:relative">
|
||||
<input
|
||||
id="password"
|
||||
name="password"
|
||||
type="password"
|
||||
required
|
||||
aria-required="true"
|
||||
autocomplete="current-password"
|
||||
placeholder="{{.locale.Tr "password"}}"
|
||||
style="flex:1;padding-right:36px"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
id="toggle-password"
|
||||
aria-label="Show password"
|
||||
title="Show password"
|
||||
style="position:absolute;right:8px;background:none;border:none;cursor:pointer;padding:4px;color:#666;font-size:16px"
|
||||
onclick="togglePasswordVisibility()"
|
||||
>👁</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<button type="submit" class="ui green button">
|
||||
{{.locale.Tr "sign_in"}}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{{if .EnableOAuth2}}
|
||||
<div class="ui divider"></div>
|
||||
<div class="field">
|
||||
<a href="{{AppSubUrl}}/user/oauth2" class="ui basic button">
|
||||
{{.locale.Tr "sign_in_with_provider"}}
|
||||
</a>
|
||||
</div>
|
||||
{{end}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function togglePasswordVisibility() {
|
||||
const input = document.getElementById('password');
|
||||
const btn = document.getElementById('toggle-password');
|
||||
if (input.type === 'password') {
|
||||
input.type = 'text';
|
||||
btn.textContent = '🙈';
|
||||
btn.setAttribute('aria-label', 'Hide password');
|
||||
btn.setAttribute('title', 'Hide password');
|
||||
} else {
|
||||
input.type = 'password';
|
||||
btn.textContent = '👁';
|
||||
btn.setAttribute('aria-label', 'Show password');
|
||||
btn.setAttribute('title', 'Show password');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{{template "base/footer" .}}
|
||||
Reference in New Issue
Block a user