@@ -141,7 +141,9 @@ const textColor = getTextColor(depth, isActive);
141141
142142<style >
143143 :global(.sidebar-item-active),
144- :global(.sidebar-item-active:visited) {
144+ :global(.sidebar-item-active:visited),
145+ :global(.sidebar-item-active) .category-title-link,
146+ :global(.sidebar-item-active) .category-title-link:visited {
145147 color: var(--text-primary) !important;
146148 /* Removed font-weight change to prevent layout shift/wrapping */
147149 }
@@ -167,6 +169,10 @@ const textColor = getTextColor(depth, isActive);
167169 color: var(--text-primary) !important;
168170 }
169171
172+ :global(.sidebar-item-hover:hover) .category-title-link {
173+ color: var(--text-primary) !important;
174+ }
175+
170176 /* Removed .sidebar-indicator styles as it's no longer used */
171177
172178 :global(.sidebar-toggle-btn:hover) {
@@ -241,11 +247,13 @@ const textColor = getTextColor(depth, isActive);
241247 });
242248 });
243249
250+ // Handle category title clicks
244251 titleLinks.forEach(link => {
245- // Check if listener already exists
246252 if (link.hasAttribute('data-listener-added')) return;
247253 link.setAttribute('data-listener-added', 'true');
248254
255+ const isNavLink = link.tagName === 'A';
256+
249257 link.addEventListener('click', (e) => {
250258 const categoryId = link.getAttribute('data-category-id');
251259 const itemsList = document.querySelector(`.category-items-container[data-category-id="${categoryId}"]`);
@@ -255,17 +263,21 @@ const textColor = getTextColor(depth, isActive);
255263 if (!itemsList || !svg) return;
256264
257265 const isCurrentlyExpanded = itemsList.classList.contains('expanded');
258- const isNavLink = link.tagName === 'A';
259266
260- // For non-nav links (buttons), toggle the category
261- if (!isNavLink) {
267+ // For navigation links: always expand if collapsed, then let navigation happen
268+ if (isNavLink) {
269+ if (!isCurrentlyExpanded) {
270+ // Expand the category (don't prevent default - let navigation happen)
271+ itemsList.classList.add('expanded');
272+ svg.style.transform = 'rotate(90deg)';
273+ }
274+ // Always allow navigation
275+ }
276+ // For buttons: always toggle
277+ else {
278+ e.preventDefault();
262279 itemsList.classList.toggle('expanded');
263280 svg.style.transform = isCurrentlyExpanded ? 'rotate(0deg)' : 'rotate(90deg)';
264- }
265- // For nav links, expand if collapsed (but don't collapse if expanded - let navigation happen)
266- else if (!isCurrentlyExpanded) {
267- itemsList.classList.add('expanded');
268- svg.style.transform = 'rotate(90deg)';
269281 }
270282 });
271283 });
0 commit comments