From fd07b99531222efa43f14c503fe80e87d9833b4d Mon Sep 17 00:00:00 2001 From: ken Date: Fri, 28 Aug 2026 16:47:51 +0800 Subject: [PATCH] update --- assets/javascripts/app.js | 47 +++++++++++++++++++ modules/ad_banner/_ad_banner_widget2.html.erb | 14 ++++++ modules/ad_banner/_ad_banner_widget3.html.erb | 14 ++++++ modules/member/member_index8.html.erb | 2 - .../web_resource/_web_res_widget8.html.erb | 19 ++++---- 5 files changed, 85 insertions(+), 11 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index be03af6..7f9cc73 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -3494,5 +3494,52 @@ $(function() { fixMemberAcademicLinkA11y(); }); +$(function() { + function fixSideMenuBtnA11y() { + setTimeout(function() { + var $btn = $('#side-menu-btn'); + if ($btn.length === 0) return; + // ✅ SVG 及其所有子元素設為不可聚焦 + $btn.find('svg, svg *').each(function() { + $(this).attr('focusable', 'false'); + $(this).attr('tabindex', '-1'); + $(this).attr('aria-hidden', 'true'); + }); + + // ✅ 確保 button 本身有正確的 aria 屬性 + $btn.attr({ + 'aria-haspopup': 'true', + 'aria-expanded': 'false', + 'aria-controls': 'mySidenav' + }); + + // ✅ 開啟時同步 aria-expanded + $btn.off('click.sideMenuA11y').on('click.sideMenuA11y', function() { + var isExpanded = $(this).attr('aria-expanded') === 'true'; + $(this).attr('aria-expanded', isExpanded ? 'false' : 'true'); + }); + + // ✅ closeNav 關閉時也同步 + var originalCloseNav = window.closeNav; + window.closeNav = function() { + if (typeof originalCloseNav === 'function') { + originalCloseNav(); + } + $btn.attr('aria-expanded', 'false'); + }; + + // ✅ 新增:關閉按鈕補上 role="button" 和圖片正確 alt + var $closeBtn = $('.closebtn'); + $closeBtn.attr({ + 'role': 'button', + 'aria-label': '關閉快速連結選單' + }); + $closeBtn.find('img').attr('alt', '關閉'); + + }, 500); + } + + fixSideMenuBtnA11y(); +}); }(jQuery, window)); diff --git a/modules/ad_banner/_ad_banner_widget2.html.erb b/modules/ad_banner/_ad_banner_widget2.html.erb index 70ef492..4c80b16 100644 --- a/modules/ad_banner/_ad_banner_widget2.html.erb +++ b/modules/ad_banner/_ad_banner_widget2.html.erb @@ -79,3 +79,17 @@ }); }); + \ No newline at end of file diff --git a/modules/ad_banner/_ad_banner_widget3.html.erb b/modules/ad_banner/_ad_banner_widget3.html.erb index f5bebb3..fdd3f39 100644 --- a/modules/ad_banner/_ad_banner_widget3.html.erb +++ b/modules/ad_banner/_ad_banner_widget3.html.erb @@ -69,3 +69,17 @@ $(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("prev"); }) + \ No newline at end of file diff --git a/modules/member/member_index8.html.erb b/modules/member/member_index8.html.erb index b29719f..e90cb77 100644 --- a/modules/member/member_index8.html.erb +++ b/modules/member/member_index8.html.erb @@ -9,9 +9,7 @@
- {{name}} -
diff --git a/modules/web_resource/_web_res_widget8.html.erb b/modules/web_resource/_web_res_widget8.html.erb index f45fe3e..4ee2e3b 100644 --- a/modules/web_resource/_web_res_widget8.html.erb +++ b/modules/web_resource/_web_res_widget8.html.erb @@ -5,15 +5,16 @@