diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index c3c0d42..1208c91 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -3848,5 +3848,76 @@ $(function() { fixAccesskeySearch(); }); +//搜尋 +$(function() { + function fixFinFaqSearchStatusA11y() { + setTimeout(function() { + + var $searchInput = $('#finFaqSearch'); + if ($searchInput.length === 0) return; + + // ✅ 加上 role="status" live region + if ($('#fin-faq-search-status').length === 0) { + $('body').append( + '
' + ); + } + + $searchInput.off('input.faqStatus').on('input.faqStatus', function() { + var keyword = $(this).val().trim(); + + setTimeout(function() { + // ✅ 計算目前可見的 FAQ 項目數 + var $visible = $('.fin-faq-item').filter(function() { + return $(this).css('display') !== 'none'; + }); + var count = $visible.length; + + var message = keyword + ? '搜尋「' + keyword + '」的結果:共找到 ' + count + ' 筆問答。' + : '顯示全部 ' + count + ' 筆問答。'; + + // ✅ 清空再設定確保每次都觸發 + $('#fin-faq-search-status').text(''); + setTimeout(function() { + $('#fin-faq-search-status').text(message); + }, 100); + + }, 300); + }); + + }, 500); + } + + fixFinFaqSearchStatusA11y(); +}); +$(function() { + function fixFinFaqInputDescA11y() { + setTimeout(function() { + var $searchInput = $('#finFaqSearch'); + if ($searchInput.length === 0) return; + + var hintId = 'finFaqSearchHint'; + + // ✅ 已有 hint 說明文字則只補 aria-describedby + if ($('#' + hintId).length > 0) { + $searchInput.attr('aria-describedby', hintId); + return; + } + + // ✅ 沒有 hint 則插入說明文字 + var $hintEl = $('輸入文字後,下方問答內容會即時自動篩選'); + + // ✅ 插在 input 之前 + $searchInput.before($hintEl); + + // ✅ 補上 aria-describedby + $searchInput.attr('aria-describedby', hintId); + + }, 500); + } + + fixFinFaqInputDescA11y(); +}); }(jQuery, window)); diff --git a/assets/stylesheets/template/layout/content.scss b/assets/stylesheets/template/layout/content.scss index d33c4a2..c7ebbea 100644 --- a/assets/stylesheets/template/layout/content.scss +++ b/assets/stylesheets/template/layout/content.scss @@ -18,7 +18,7 @@ caption{ position: relative; width: 100%; overflow: hidden; - z-index: unset !important; + z-index: 1; } .internal-page{ .layout-content{ diff --git a/modules/ad_banner/_ad_banner_widget2.html.erb b/modules/ad_banner/_ad_banner_widget2.html.erb index 06db79d..b74bbbc 100644 --- a/modules/ad_banner/_ad_banner_widget2.html.erb +++ b/modules/ad_banner/_ad_banner_widget2.html.erb @@ -29,9 +29,7 @@ - +