Skip to content

Commit 1aa499c

Browse files
Updated the sliding indicator
1 parent b9d10a6 commit 1aa499c

1 file changed

Lines changed: 0 additions & 71 deletions

File tree

contentcuration/contentcuration/frontend/shared/views/StudioNavigation.vue

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@
139139
<div
140140
ref="tabsContainer"
141141
class="studio-navigation__tabs-container"
142-
@keydown="handleTabsKeydown"
143142
>
144143
<slot name="tabs"></slot>
145144
<div
@@ -421,7 +420,6 @@
421420
},
422421
},
423422
mounted() {
424-
this.updateTabIndices();
425423
this.updateWindowWidth();
426424
this.updateToolbarWidth();
427425
window.addEventListener('resize', this.handleResize);
@@ -438,7 +436,6 @@
438436
},
439437
updated() {
440438
this.$nextTick(() => {
441-
this.updateTabIndices();
442439
this.updateToolbarWidth();
443440
});
444441
},
@@ -562,75 +559,7 @@
562559
}
563560
return value;
564561
},
565-
handleTabsKeydown(event) {
566-
const tabs = this.getTabElements();
567-
if (!tabs.length) return;
568562
569-
const currentIndex = tabs.findIndex(
570-
tab => tab === event.target || tab.contains(event.target),
571-
);
572-
573-
if (currentIndex === -1) return;
574-
575-
let nextIndex = currentIndex;
576-
577-
switch (event.key) {
578-
case 'ArrowLeft':
579-
event.preventDefault();
580-
nextIndex = currentIndex > 0 ? currentIndex - 1 : tabs.length - 1;
581-
if (this.$isRTL) {
582-
nextIndex = currentIndex < tabs.length - 1 ? currentIndex + 1 : 0;
583-
}
584-
break;
585-
586-
case 'ArrowRight':
587-
event.preventDefault();
588-
nextIndex = currentIndex < tabs.length - 1 ? currentIndex + 1 : 0;
589-
if (this.$isRTL) {
590-
nextIndex = currentIndex > 0 ? currentIndex - 1 : tabs.length - 1;
591-
}
592-
break;
593-
594-
default:
595-
return;
596-
}
597-
598-
this.focusTab(tabs[nextIndex]);
599-
},
600-
getTabElements() {
601-
if (!this.$refs.tabsContainer) return [];
602-
603-
const tabs = Array.from(
604-
this.$refs.tabsContainer.querySelectorAll('a[role], button[role="tab"], a[href]'),
605-
);
606-
607-
return tabs;
608-
},
609-
focusTab(tabElement) {
610-
if (!tabElement) return;
611-
612-
const vueInstance = tabElement.__vueParentComponent?.ctx;
613-
if (vueInstance?.focus) {
614-
vueInstance.focus();
615-
} else {
616-
tabElement.focus();
617-
}
618-
},
619-
updateTabIndices() {
620-
const tabs = this.getTabElements();
621-
if (!tabs.length) return;
622-
623-
const activeTab = tabs.find(
624-
tab =>
625-
tab.getAttribute('aria-current') === 'page' ||
626-
tab.getAttribute('aria-selected') === 'true',
627-
);
628-
const focusableTab = activeTab || tabs[0];
629-
630-
tabs.forEach(tab => {
631-
tab.setAttribute('tabindex', tab === focusableTab ? '0' : '-1');
632-
});
633-
},
634563
},
635564
$trs: {
636565
title: 'Kolibri Studio',

0 commit comments

Comments
 (0)