Skip to content

Commit b195b56

Browse files
🎨 Palette: Improve accessibility of icon-only buttons and toggles
Co-authored-by: alvin000009238 <107313913+alvin000009238@users.noreply.github.com>
1 parent b80f22e commit b195b56

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

frontend/sync.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,13 @@ export function setupSyncFeature() {
272272
if (type === 'text') {
273273
eyeIcon.style.display = 'none';
274274
eyeOffIcon.style.display = 'block';
275+
togglePasswordBtn.setAttribute('aria-label', '隱藏密碼');
276+
togglePasswordBtn.setAttribute('title', '隱藏密碼');
275277
} else {
276278
eyeIcon.style.display = 'block';
277279
eyeOffIcon.style.display = 'none';
280+
togglePasswordBtn.setAttribute('aria-label', '顯示密碼');
281+
togglePasswordBtn.setAttribute('title', '顯示密碼');
278282
}
279283
});
280284
}

public/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ <h3>
102102
<span class="material-symbols-outlined" style="font-size: 24px;">share</span>
103103
分享成績單
104104
</h3>
105-
<button class="modal-close" id="closeShareModal">&times;</button>
105+
<button class="modal-close" id="closeShareModal" aria-label="關閉視窗">&times;</button>
106106
</div>
107107
<div class="modal-body">
108108
<div id="sharePreview"></div>
@@ -116,10 +116,10 @@ <h3>
116116
<div class="modal-header">
117117
<h3 style="display: flex; align-items: center; gap: 8px;">
118118
登入系統
119-
<span class="material-symbols-outlined tooltip-icon" tabindex="0"
119+
<span class="material-symbols-outlined tooltip-icon" tabindex="0" aria-label="提示說明" role="button"
120120
data-tooltip="請使用欣河校園平台帳密登入">help</span>
121121
</h3>
122-
<button class="modal-close" id="closeLoginModal">&times;</button>
122+
<button class="modal-close" id="closeLoginModal" aria-label="關閉視窗">&times;</button>
123123
</div>
124124
<div class="modal-body">
125125
<form id="loginForm" method="post" action="javascript:void(0);">
@@ -133,7 +133,7 @@ <h3 style="display: flex; align-items: center; gap: 8px;">
133133
<input type="password" id="passwordInput" name="password"
134134
autocomplete="current-password" placeholder=" ">
135135
<label>密碼</label>
136-
<button type="button" id="togglePasswordBtn" class="toggle-password-btn" tabindex="-1">
136+
<button type="button" id="togglePasswordBtn" class="toggle-password-btn" aria-label="顯示密碼" title="顯示密碼">
137137
<span class="material-symbols-outlined eye-icon">visibility</span>
138138
<span class="material-symbols-outlined eye-off-icon"
139139
style="display: none;">visibility_off</span>
@@ -160,7 +160,7 @@ <h3 style="display: flex; align-items: center; gap: 8px;">
160160
<div class="modal-content sm">
161161
<div class="modal-header">
162162
<h3>選擇考試</h3>
163-
<button class="modal-close" id="closeSelectModal">&times;</button>
163+
<button class="modal-close" id="closeSelectModal" aria-label="關閉視窗">&times;</button>
164164
</div>
165165
<div class="modal-body">
166166
<div class="form-group">

0 commit comments

Comments
 (0)