Skip to content
Snippets Groups Projects
Commit 1926a049 authored by Sourav Paul's avatar Sourav Paul Committed by Chris Wells
Browse files

Issue #3479907 by utkarsh_33, sourav_paul, rkoller: Only the active source...

Issue #3479907 by utkarsh_33, sourav_paul, rkoller: Only the active source type tab is included in the tabindex
parent ae255f91
No related branches found
No related tags found
No related merge requests found
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -3,7 +3,6 @@
import ActionButton from './Project/ActionButton.svelte';
import Image from './Project/Image.svelte';
import ImageCarousel from './ImageCarousel.svelte';
import { moduleCategoryFilter, page } from './stores';
import ProjectIcon from './Project/ProjectIcon.svelte';
import { numberFormatter } from './util';
import { BASE_URL } from './constants';
......@@ -12,12 +11,6 @@
export let project;
const { Drupal } = window;
function filterByCategory(id) {
$moduleCategoryFilter = [id];
$page = 0;
window.location.href = `${BASE_URL}admin/modules/browse`;
}
onMount(() => {
const anchors = document
.getElementById('description-wrapper')
......
......@@ -8,46 +8,12 @@
// eslint-disable-next-line import/no-mutable-exports,import/prefer-default-export
export let dataArray = [];
let tabButtons;
// Enable arrow navigation between tabs in the tab list
function onKeydown(e) {
// Enable arrow navigation between tabs in the tab list
let tabFocus;
const tabs = tabButtons.querySelectorAll('[role="tab"]');
for (let i = 0; i < tabs.length; i++) {
if (tabs[i].getAttribute('tabindex') === '0') {
tabFocus = i;
}
}
// Move right
if (e.keyCode === 39 || e.keyCode === 37) {
tabs[tabFocus].setAttribute('tabindex', -1);
if (e.keyCode === 39) {
tabFocus += 1;
// If we're at the end, go to the start
if (tabFocus >= tabs.length) {
tabFocus = 0;
}
// Move left
} else if (e.keyCode === 37) {
tabFocus -= 1;
// If we're at the start, move to the end
if (tabFocus < 0) {
tabFocus = tabs.length - 1;
}
}
tabs[tabFocus].setAttribute('tabindex', 0);
tabs[tabFocus].focus();
}
}
</script>
<!--Show tabs only if there are 2 or more plugins enabled.-->
{#if dataArray.length >= 2}
<nav class="tabs-wrapper tabs-wrapper--secondary is-horizontal">
<div
on:keydown={onKeydown}
role="tablist"
id="plugin-tabs"
aria-label={Drupal.t('Plugin tabs')}
......@@ -65,7 +31,7 @@
role="tab"
aria-selected={isActive ? 'true' : 'false'}
aria-controls={pluginId}
tabindex={isActive ? '0' : '-1'}
tabindex="0"
id={pluginId}
class="pb-tabs__link tabs__link"
class:is-active={isActive === true}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment