mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-19 02:14:35 +08:00
Compare commits
1 Commits
220cb7428b
...
palette-pa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7a0cb589b |
3
.Jules/palette.md
Normal file
3
.Jules/palette.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
## 2025-05-14 - Password Visibility Toggle Accessibility
|
||||||
|
**Learning:** Icon-only buttons for toggling password visibility are often missing `aria-label` and `aria-pressed` states, making them unusable for screen reader users who need to verify their input.
|
||||||
|
**Action:** Always include dynamic `aria-label` (Switching between "Show password" and "Hide password") and `aria-pressed` state for password toggles.
|
||||||
@@ -334,6 +334,12 @@ export function LoginPage() {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={() => setShowPassword(!showPassword)}
|
onClick={() => setShowPassword(!showPassword)}
|
||||||
className="absolute right-3 top-1/2 -translate-y-1/2 text-zinc-600 hover:text-zinc-400 transition-colors"
|
className="absolute right-3 top-1/2 -translate-y-1/2 text-zinc-600 hover:text-zinc-400 transition-colors"
|
||||||
|
aria-label={
|
||||||
|
showPassword
|
||||||
|
? t('hidePassword', language)
|
||||||
|
: t('showPassword', language)
|
||||||
|
}
|
||||||
|
aria-pressed={showPassword}
|
||||||
>
|
>
|
||||||
{showPassword ? <EyeOff size={16} /> : <Eye size={16} />}
|
{showPassword ? <EyeOff size={16} /> : <Eye size={16} />}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -248,6 +248,12 @@ export function RegisterPage() {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={() => setShowPassword(!showPassword)}
|
onClick={() => setShowPassword(!showPassword)}
|
||||||
className="absolute right-3 top-1/2 -translate-y-1/2 text-zinc-600 hover:text-zinc-400 transition-colors"
|
className="absolute right-3 top-1/2 -translate-y-1/2 text-zinc-600 hover:text-zinc-400 transition-colors"
|
||||||
|
aria-label={
|
||||||
|
showPassword
|
||||||
|
? t('hidePassword', language)
|
||||||
|
: t('showPassword', language)
|
||||||
|
}
|
||||||
|
aria-pressed={showPassword}
|
||||||
>
|
>
|
||||||
{showPassword ? <EyeOff size={16} /> : <Eye size={16} />}
|
{showPassword ? <EyeOff size={16} /> : <Eye size={16} />}
|
||||||
</button>
|
</button>
|
||||||
@@ -269,6 +275,12 @@ export function RegisterPage() {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={() => setShowConfirmPassword(!showConfirmPassword)}
|
onClick={() => setShowConfirmPassword(!showConfirmPassword)}
|
||||||
className="absolute right-3 top-1/2 -translate-y-1/2 text-zinc-600 hover:text-zinc-400 transition-colors"
|
className="absolute right-3 top-1/2 -translate-y-1/2 text-zinc-600 hover:text-zinc-400 transition-colors"
|
||||||
|
aria-label={
|
||||||
|
showConfirmPassword
|
||||||
|
? t('hidePassword', language)
|
||||||
|
: t('showPassword', language)
|
||||||
|
}
|
||||||
|
aria-pressed={showConfirmPassword}
|
||||||
>
|
>
|
||||||
{showConfirmPassword ? <EyeOff size={16} /> : <Eye size={16} />}
|
{showConfirmPassword ? <EyeOff size={16} /> : <Eye size={16} />}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -150,6 +150,12 @@ export function ResetPasswordPage() {
|
|||||||
onClick={() => setShowPassword(!showPassword)}
|
onClick={() => setShowPassword(!showPassword)}
|
||||||
className="absolute inset-y-0 right-2 w-8 h-10 flex items-center justify-center btn-icon"
|
className="absolute inset-y-0 right-2 w-8 h-10 flex items-center justify-center btn-icon"
|
||||||
style={{ color: 'var(--text-secondary)' }}
|
style={{ color: 'var(--text-secondary)' }}
|
||||||
|
aria-label={
|
||||||
|
showPassword
|
||||||
|
? t('hidePassword', language)
|
||||||
|
: t('showPassword', language)
|
||||||
|
}
|
||||||
|
aria-pressed={showPassword}
|
||||||
>
|
>
|
||||||
{showPassword ? (
|
{showPassword ? (
|
||||||
<EyeOff className="w-5 h-5" />
|
<EyeOff className="w-5 h-5" />
|
||||||
@@ -184,6 +190,12 @@ export function ResetPasswordPage() {
|
|||||||
}
|
}
|
||||||
className="absolute inset-y-0 right-2 w-8 h-10 flex items-center justify-center btn-icon"
|
className="absolute inset-y-0 right-2 w-8 h-10 flex items-center justify-center btn-icon"
|
||||||
style={{ color: 'var(--text-secondary)' }}
|
style={{ color: 'var(--text-secondary)' }}
|
||||||
|
aria-label={
|
||||||
|
showConfirmPassword
|
||||||
|
? t('hidePassword', language)
|
||||||
|
: t('showPassword', language)
|
||||||
|
}
|
||||||
|
aria-pressed={showConfirmPassword}
|
||||||
>
|
>
|
||||||
{showConfirmPassword ? (
|
{showConfirmPassword ? (
|
||||||
<EyeOff className="w-5 h-5" />
|
<EyeOff className="w-5 h-5" />
|
||||||
|
|||||||
@@ -667,6 +667,8 @@ export const translations = {
|
|||||||
passwordRequired: 'Password is required',
|
passwordRequired: 'Password is required',
|
||||||
invalidEmail: 'Invalid email format',
|
invalidEmail: 'Invalid email format',
|
||||||
passwordTooShort: 'Password must be at least 6 characters',
|
passwordTooShort: 'Password must be at least 6 characters',
|
||||||
|
showPassword: 'Show password',
|
||||||
|
hidePassword: 'Hide password',
|
||||||
|
|
||||||
// Landing Page
|
// Landing Page
|
||||||
features: 'Features',
|
features: 'Features',
|
||||||
@@ -1834,6 +1836,8 @@ export const translations = {
|
|||||||
passwordRequired: '请输入密码',
|
passwordRequired: '请输入密码',
|
||||||
invalidEmail: '邮箱格式不正确',
|
invalidEmail: '邮箱格式不正确',
|
||||||
passwordTooShort: '密码至少需要6个字符',
|
passwordTooShort: '密码至少需要6个字符',
|
||||||
|
showPassword: '显示密码',
|
||||||
|
hidePassword: '隐藏密码',
|
||||||
|
|
||||||
// Landing Page
|
// Landing Page
|
||||||
features: '功能',
|
features: '功能',
|
||||||
|
|||||||
Reference in New Issue
Block a user