@hortonstudio/main 1.1.30 → 1.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/utils/navbar.js +13 -2
- package/utils/toc.js +4 -0
package/package.json
CHANGED
package/utils/navbar.js
CHANGED
@@ -95,6 +95,10 @@ export const init = () => {
|
|
95
95
|
toggle.setAttribute('aria-expanded', 'false');
|
96
96
|
list.setAttribute('aria-hidden', 'true');
|
97
97
|
|
98
|
+
// Temporarily remove role="menu" to help screen readers understand menu is closed
|
99
|
+
const originalRole = list.getAttribute('role');
|
100
|
+
list.removeAttribute('role');
|
101
|
+
|
98
102
|
// GSAP animation
|
99
103
|
currentTimeline = gsap.timeline();
|
100
104
|
currentTimeline.to(contain, {
|
@@ -116,11 +120,18 @@ export const init = () => {
|
|
116
120
|
duration: animationDuration,
|
117
121
|
ease: 'ease'
|
118
122
|
}, 0)
|
119
|
-
.set(list, { display: 'none' })
|
123
|
+
.set(list, { display: 'none' })
|
124
|
+
.call(() => {
|
125
|
+
// Restore role after animation completes
|
126
|
+
list.setAttribute('role', originalRole || 'menu');
|
127
|
+
});
|
120
128
|
|
121
129
|
// Restore focus to toggle only if focus was inside dropdown
|
122
130
|
if (shouldRestoreFocus) {
|
123
|
-
|
131
|
+
// Small delay to ensure screen reader announces the state change
|
132
|
+
setTimeout(() => {
|
133
|
+
toggle.focus();
|
134
|
+
}, 50);
|
124
135
|
}
|
125
136
|
}
|
126
137
|
|
package/utils/toc.js
CHANGED
@@ -51,6 +51,10 @@ export async function init() {
|
|
51
51
|
const targetSection = document.getElementById(sectionId);
|
52
52
|
if (targetSection) {
|
53
53
|
targetSection.scrollIntoView({ behavior: 'smooth' });
|
54
|
+
// Focus on the section for accessibility (will only show outline for keyboard users due to CSS)
|
55
|
+
setTimeout(() => {
|
56
|
+
targetSection.focus();
|
57
|
+
}, 100);
|
54
58
|
}
|
55
59
|
});
|
56
60
|
|