This commit is contained in:
ken 2026-08-07 16:05:09 +08:00
parent 5cc38aee0a
commit 09669da563
2 changed files with 49 additions and 1 deletions

View File

@ -1216,6 +1216,47 @@ $(function() {
fixAccessibilityAll(); fixAccessibilityAll();
}, 800); }, 800);
}); });
// 修正漢堡選單按鈕無障礙
$(function() {
function fixNavbarToggleA11y() {
var isEn = $('html').attr('lang') === 'en';
var label = isEn ? '開啟或關閉導覽選單' : '開啟或關閉導覽選單';
$('.navbar-toggle').each(function() {
var $btn = $(this);
// 修正 title
$btn.attr('title', label);
// 修正 sr-only 文字(原本是 "Toggle navigation"
var $sr = $btn.find('.sr-only');
if ($sr.length) {
$sr.text(label);
} else {
$btn.prepend('<span class="sr-only">' + label + '</span>');
}
// 補上 aria-label
$btn.attr('aria-label', label);
// 補上 aria-expanded依據目前是否展開
if (!$btn.attr('aria-expanded')) {
var isExpanded = !$btn.hasClass('collapsed');
$btn.attr('aria-expanded', isExpanded ? 'true' : 'false');
}
// 點擊時同步更新 aria-expanded
$btn.off('click.navA11y').on('click.navA11y', function() {
setTimeout(function() {
var isExpanded = !$('.navbar-toggle').hasClass('collapsed');
$('.navbar-toggle').attr('aria-expanded', isExpanded ? 'true' : 'false');
}, 50);
});
});
}
setTimeout(fixNavbarToggleA11y, 500);
});
$(function() { $(function() {

View File

@ -9,7 +9,14 @@
// Announcement widget // Announcement widget
// ## Gerneral styles for widgets // ## Gerneral styles for widgets
td.i-annc__postdate { td.i-annc__postdate {
min-width: 7em; min-width: 8em;
}
.i-annc__table{
@media (max-width: 480px){
td,th{
width: auto!important;
}
}
} }
strong.carousel__description{ strong.carousel__description{
color: #333!important; color: #333!important;