diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 0a12577..5defeeb 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -533,20 +533,28 @@ $(document).ready(function () { }); //播放驗證碼語音 $(function () { - $('.ask-question') - .find('.controls button.fas.fa-volume-up') - .each(function () { - const $btn = $(this); + var pageLang = ($('html').attr('lang') || 'zh-Hant').toLowerCase(); + var isEn = pageLang.startsWith('en'); + var label = isEn ? 'Play Captcha Voice' : '播放驗證碼語音'; - // 已經補過就不重複處理 - if ($btn.attr('aria-label')) return; + $('.ask-question') + .find('.controls button.fas.fa-volume-up') + .each(function () { + var $btn = $(this); - $btn.attr({ - 'aria-label': '播放驗證碼語音', - 'aria-controls': 'captcha_audio', - 'role': 'button' - }); - }); + $btn.attr({ + 'aria-label': label, + 'title': label, + 'aria-controls': 'captcha_audio', + 'role': 'button' + }); + + // ✅ 同步更新 sr-only 文字(若有) + var $sr = $btn.find('.sr-only'); + if ($sr.length > 0) { + $sr.text(label); + } + }); }); //刪除td的id @@ -3429,6 +3437,50 @@ $(document).ready(function () { // 比 fixAccessibilityAll 的 800ms 晚,確保最後執行 setTimeout(fixGalleryViewLinkA11y, 2000); }); +//No History Records +function fixTicketHistoryStatusA11y() { + var $form = $('#check_history_form'); + if (!$form.length) return; + + // 建立 role=status 播報區(若不存在) + if (!$('#ticket-history-result-status').length) { + $form.after('
'); + } + + var $statusBox = $('#ticket-history-result-status'); + + // MutationObserver 監聽 #history_area 的變化 + var $historyArea = $('#history_area'); + if (!$historyArea.length) return; + + var observer = new MutationObserver(function () { + var $noRecord = $historyArea.find('span.translation_missing'); + if ($noRecord.length) { + // 取得文字(顯示文字或 title 屬性) + var msg = $noRecord.text().trim() || $noRecord.attr('title') || 'No History Records'; + + // 把訊息寫入 role=status 區塊觸發播報 + $statusBox.text('').text(msg); + + // 同時在 span 上加 role=status(雙保險) + if ($noRecord.attr('role') !== 'status') { + $noRecord.attr('role', 'status').attr('aria-live', 'polite').attr('aria-atomic', 'true'); + } + } else { + // 有查到結果時清空播報區 + $statusBox.text(''); + } + }); + + observer.observe($historyArea[0], { + childList: true, + subtree: true + }); +} + +$(document).ready(function () { + setTimeout(fixTicketHistoryStatusA11y, 500); +}); //會員 $(function() { function fixMemberAcademicLinkA11y() { diff --git a/assets/stylesheets/template/base/_global.scss b/assets/stylesheets/template/base/_global.scss index b5ee77e..c520561 100644 --- a/assets/stylesheets/template/base/_global.scss +++ b/assets/stylesheets/template/base/_global.scss @@ -214,6 +214,10 @@ img{ // overflow-x: auto; // } // } -*[data-pp]>.editmode-ps>a, .admin-subpart-area .content>.editmode-ps>a{ - position: !important; +input[type=checkbox]:focus { + outline: 0.3125em auto -webkit-focus-ring-color!important; +} +button.fas.fa-volume-up:focus { + outline: 0.3125em auto -webkit-focus-ring-color!important; + outline-offset: -0.125em!important; } \ No newline at end of file diff --git a/assets/stylesheets/template/layout/content.scss b/assets/stylesheets/template/layout/content.scss index a56fb95..23c68ee 100644 --- a/assets/stylesheets/template/layout/content.scss +++ b/assets/stylesheets/template/layout/content.scss @@ -1,6 +1,13 @@ @charset "utf-8"; @import "../initial"; +.ask-question-form .form-actions input { + float: none !important; + margin-right: 1em; +} +.ask-question .form-horizontal .form-actions { + text-align: end!important; +} .line-it-button{ .label{ color: #333!important; diff --git a/modules/archive/archive_index2.html.erb b/modules/archive/archive_index2.html.erb index 8befccd..054a806 100644 --- a/modules/archive/archive_index2.html.erb +++ b/modules/archive/archive_index2.html.erb @@ -26,8 +26,7 @@ diff --git a/modules/member/member_index2.html.erb b/modules/member/member_index2.html.erb index 01a79dd..555a6fa 100644 --- a/modules/member/member_index2.html.erb +++ b/modules/member/member_index2.html.erb @@ -8,9 +8,9 @@