diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js
index d2bce52..9b0d1ff 100644
--- a/assets/javascripts/app.js
+++ b/assets/javascripts/app.js
@@ -2127,28 +2127,68 @@ $(document).ready(function () {
//rucaptcha-image
$(document).ready(function () {
- // >>> 修正:先確認頁面上真的有驗證碼圖片,再往下執行,避免沒有驗證碼的頁面也發出多餘的 wav 請求
- if ($('.rucaptcha-image').length) {
- $('.rucaptcha-image').removeAttr('onload');
- // 檢查是否已插入過
- if (!$('#captcha_audio').length) {
- const audioButton = $(`
-
- `);
- const audio = $('');
- $('.rucaptcha-image').after(audioButton, audio);
- }
+ function fixCaptchaImgA11y() {
+ setTimeout(function () {
+ // ✅ 先確認頁面上真的有驗證碼圖片,再往下執行
+ if (!$('.rucaptcha-image').length) return;
+
+ var pageLang = ($('html').attr('lang') || 'zh-Hant').toLowerCase();
+ var isEn = pageLang.startsWith('en');
+
+ var i18n = {
+ alt: isEn ? 'Captcha image, click to refresh' : '驗證碼圖片,點擊可更換',
+ title: isEn ? 'Captcha image, click to refresh' : '驗證碼圖片,點擊可更換',
+ label: isEn ? 'Click to refresh captcha' : '點擊更換驗證碼',
+ audioBtn: isEn ? 'Play captcha audio' : '播放驗證碼語音',
+ audioSrc: isEn ? '/rucaptcha/?format=wav&locale=en' : '/rucaptcha/?format=wav&locale=zh_tw'
+ };
+
+ var $captchaImg = $('.rucaptcha-image');
+
+ // ✅ 移除 onload
+ $captchaImg.removeAttr('onload');
+
+ // ✅ 補上有意義的 alt、role、tabindex、title
+ $captchaImg.attr({
+ 'alt': i18n.alt,
+ 'title': i18n.title,
+ 'role': 'button',
+ 'tabindex': '0',
+ 'aria-label': i18n.label
+ });
+
+ // ✅ Enter / Space 觸發更換驗證碼
+ $captchaImg.off('keydown.captchaA11y').on('keydown.captchaA11y', function (e) {
+ if (e.which === 13 || e.which === 32) {
+ e.preventDefault();
+ $(this).trigger('click');
+ }
+ });
+
+ // ✅ 插入語音按鈕和 audio(若還沒插入過)
+ if (!$('#captcha_audio').length) {
+ var $audioButton = $(
+ ''
+ );
+
+ var $audio = $('');
+
+ $captchaImg.after($audioButton, $audio);
+ }
+
+ }, 500);
}
- // <<< 修正結束
+
+ fixCaptchaImgA11y();
});
//萬用表格searchbtn2
@@ -3517,4 +3557,59 @@ $(function() {
fixLabelForMismatch();
});
+//bannercontrolplay
+$(function() {
+ function fixBannerPlayPauseA11y() {
+ setTimeout(function() {
+ var pageLang = ($('html').attr('lang') || 'zh-Hant').toLowerCase();
+ var isEn = pageLang.startsWith('en');
+
+ var i18n = {
+ resume: isEn ? 'Play' : '繼續播放',
+ pause: isEn ? 'Pause' : '暫停播放'
+ };
+
+ $('.w-ba-banner').each(function() {
+ var $banner = $(this);
+ var $controlplay = $banner.find('.controlplay');
+
+ // ✅ 把 radiogroup 改為一般容器
+ $controlplay.removeAttr('role aria-label');
+
+ // ✅ 繼續播放按鈕
+ var $resume = $banner.find('.resume-slide');
+ $resume
+ .attr('role', 'button')
+ .attr('aria-pressed', $resume.hasClass('active') ? 'true' : 'false')
+ .attr('aria-label', i18n.resume)
+ .attr('title', i18n.resume)
+ .removeAttr('aria-checked aria-live');
+
+ // ✅ 暫停播放按鈕
+ var $pause = $banner.find('.pause-slide');
+ $pause
+ .attr('role', 'button')
+ .attr('aria-pressed', $pause.hasClass('active') ? 'true' : 'false')
+ .attr('aria-label', i18n.pause)
+ .attr('title', i18n.pause)
+ .removeAttr('aria-checked aria-live');
+
+ // ✅ 點擊後同步 aria-pressed
+ $resume.off('click.bannerA11y').on('click.bannerA11y', function() {
+ $resume.attr('aria-pressed', 'true');
+ $pause.attr('aria-pressed', 'false');
+ });
+
+ $pause.off('click.bannerA11y').on('click.bannerA11y', function() {
+ $pause.attr('aria-pressed', 'true');
+ $resume.attr('aria-pressed', 'false');
+ });
+ });
+
+ }, 800);
+ }
+
+ fixBannerPlayPauseA11y();
+});
+
}(jQuery, window));
diff --git a/assets/stylesheets/template/modules/ad_banner.scss b/assets/stylesheets/template/modules/ad_banner.scss
index 356dd18..8a9031f 100644
--- a/assets/stylesheets/template/modules/ad_banner.scss
+++ b/assets/stylesheets/template/modules/ad_banner.scss
@@ -35,6 +35,7 @@ ul.button-mid{
width: 100%;
height: 0;
top: 50%;
+ z-index: 201;
}
.banner-pager .active-slide button{
background: $theme-color-second!important;
@@ -44,6 +45,7 @@ ul.button-mid{
width: 100%;
height: 0;
top: 50%;
+ z-index: 201;
}
.next-button, .prev-button {
cursor: pointer;
diff --git a/modules/ad_banner/_ad_banner_widget2.html.erb b/modules/ad_banner/_ad_banner_widget2.html.erb
index 585915e..b74bbbc 100644
--- a/modules/ad_banner/_ad_banner_widget2.html.erb
+++ b/modules/ad_banner/_ad_banner_widget2.html.erb
@@ -47,20 +47,23 @@