Skip to content

Commit

Permalink
Merge branch 'main' into N21-2106-fix-school-features
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinOehlerkingCap authored Jul 26, 2024
2 parents 75986d8 + a1e7744 commit a754a67
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions static/scripts/loggedin.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,17 @@ function toggleSidebar() {
const sidebar = document.querySelector('.sidebar');
const overlay = document.querySelector('.overlay');
const contentDiv = document.querySelector('.content-min-height');
const sidebarItems = document.querySelectorAll('.sidebar-item');
const sidebarSubitems = document.querySelectorAll('.subitem');
const legalLinks = document.querySelectorAll('.legal-link');

if (sidebar) {
if (sidebar.classList.contains('hidden')) {
sidebar.classList.remove('hidden');
sidebar.classList.add('visible');
toggleTabindexOnSidebarItems(sidebarItems, 0);
toggleTabindexOnSidebarItems(legalLinks, 0);
toggleTabindexOnSidebarItems(sidebarSubitems, 0);

if (window.innerWidth <= 1279) {
overlay.style.display = "block";
Expand All @@ -78,6 +84,9 @@ function toggleSidebar() {
} else {
sidebar.classList.remove('visible');
sidebar.classList.add('hidden');
toggleTabindexOnSidebarItems(sidebarItems, -1);
toggleTabindexOnSidebarItems(legalLinks, -1);
toggleTabindexOnSidebarItems(sidebarSubitems, -1);

if (window.innerWidth <= 1279) {
overlay.style.display = "none";
Expand All @@ -104,6 +113,13 @@ function toggleSidebar() {
}
}

function toggleTabindexOnSidebarItems(elements, tabindex) {
[].forEach.call(elements, function (el) {
el.setAttribute("tabindex", tabindex);
el.setAttribute("aria-hidden", true);
});
}

function toggleSidebarOnWindowWidth(sidebar) {
const overlay = document.querySelector('.overlay');

Expand Down

0 comments on commit a754a67

Please sign in to comment.