|
287 | 287 | <div id="leftPane"> |
288 | 288 | <div class="nav-header"> |
289 | 289 | <a class="nav-header-home" href="index.html">${homeLinkLabel}</a> |
| 290 | + <button class="mobile-nav-toggle" id="mobileNavToggle" aria-label="Toggle navigation">☰</button> |
290 | 291 | </div> |
291 | 292 | <div class="search-container" id="navSearchContainer"> |
292 | 293 | <form name="searchForm" id="searchForm" class="search-form" onsubmit="return false;"> |
|
295 | 296 | <div class="search-feedback" id="searchStatus"></div> |
296 | 297 | <ul class="search-results" id="searchResults"></ul> |
297 | 298 | </div> |
298 | | - <button class="expand-all-btn" onclick="toggleAllSections()">Expand All</button> |
299 | | - <ul class="nav-tree" id="navTree"> |
300 | | - <!-- Navigation will be populated here --> |
301 | | - </ul> |
| 299 | + <div class="nav-content" id="navContent"> |
| 300 | + <button class="expand-all-btn" onclick="toggleAllSections()">Expand All</button> |
| 301 | + <ul class="nav-tree" id="navTree"> |
| 302 | + <!-- Navigation will be populated here --> |
| 303 | + </ul> |
| 304 | + </div> |
302 | 305 | </div> |
303 | 306 | <div class="pane-resizer" id="paneResizer"></div> |
304 | 307 | <div id="contentPane"> |
|
308 | 311 | `; |
309 | 312 |
|
310 | 313 | updateHomeLinkLabel(); |
| 314 | + setupMobileNavToggle(); |
311 | 315 | } |
312 | 316 |
|
313 | 317 | function populateLeftNavigation() { |
|
1138 | 1142 | return entry.type + '|' + entry.titleLower + '|' + entry.href; |
1139 | 1143 | } |
1140 | 1144 |
|
| 1145 | + function setupMobileNavToggle() { |
| 1146 | + var toggleBtn = document.getElementById('mobileNavToggle'); |
| 1147 | + var navContent = document.getElementById('navContent'); |
| 1148 | + var leftPane = document.getElementById('leftPane'); |
| 1149 | + |
| 1150 | + if (!toggleBtn || !navContent) return; |
| 1151 | + |
| 1152 | + toggleBtn.addEventListener('click', function() { |
| 1153 | + var isExpanded = leftPane.classList.contains('nav-expanded'); |
| 1154 | + |
| 1155 | + if (isExpanded) { |
| 1156 | + leftPane.classList.remove('nav-expanded'); |
| 1157 | + toggleBtn.textContent = '☰'; |
| 1158 | + toggleBtn.setAttribute('aria-expanded', 'false'); |
| 1159 | + } else { |
| 1160 | + leftPane.classList.add('nav-expanded'); |
| 1161 | + toggleBtn.textContent = '✕'; |
| 1162 | + toggleBtn.setAttribute('aria-expanded', 'true'); |
| 1163 | + } |
| 1164 | + }); |
| 1165 | + |
| 1166 | + // Close mobile nav when clicking on content area |
| 1167 | + var contentPane = document.getElementById('contentPane'); |
| 1168 | + if (contentPane) { |
| 1169 | + contentPane.addEventListener('click', function() { |
| 1170 | + if (leftPane.classList.contains('nav-expanded')) { |
| 1171 | + leftPane.classList.remove('nav-expanded'); |
| 1172 | + toggleBtn.textContent = '☰'; |
| 1173 | + toggleBtn.setAttribute('aria-expanded', 'false'); |
| 1174 | + } |
| 1175 | + }); |
| 1176 | + } |
| 1177 | + |
| 1178 | + // Close mobile nav when selecting a navigation item |
| 1179 | + document.addEventListener('click', function(event) { |
| 1180 | + var navItem = event.target.closest('.nav-item a'); |
| 1181 | + if (navItem && leftPane.classList.contains('nav-expanded')) { |
| 1182 | + setTimeout(function() { |
| 1183 | + leftPane.classList.remove('nav-expanded'); |
| 1184 | + toggleBtn.textContent = '☰'; |
| 1185 | + toggleBtn.setAttribute('aria-expanded', 'false'); |
| 1186 | + }, 100); |
| 1187 | + } |
| 1188 | + }); |
| 1189 | + |
| 1190 | + // Improve focus management for mobile |
| 1191 | + toggleBtn.setAttribute('aria-expanded', 'false'); |
| 1192 | + toggleBtn.setAttribute('aria-controls', 'navContent'); |
| 1193 | + |
| 1194 | + // Handle escape key to close mobile nav |
| 1195 | + document.addEventListener('keydown', function(event) { |
| 1196 | + if (event.key === 'Escape' && leftPane.classList.contains('nav-expanded')) { |
| 1197 | + leftPane.classList.remove('nav-expanded'); |
| 1198 | + toggleBtn.textContent = '☰'; |
| 1199 | + toggleBtn.setAttribute('aria-expanded', 'false'); |
| 1200 | + toggleBtn.focus(); |
| 1201 | + } |
| 1202 | + }); |
| 1203 | + } |
| 1204 | + |
1141 | 1205 | // Make functions globally available for onclick handlers |
1142 | 1206 | window.toggleAllSections = toggleAllSections; |
1143 | 1207 |
|
|
0 commit comments