Skip to content

Commit

Permalink
feat(#50): make panels keyboard accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianSolberg committed Oct 29, 2025
1 parent 090da51 commit 8189a40
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/Accessibility/makeMenuTabbable.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
* Makes menu tabbable keyboard accessible.
*/
export function makeMenuTabbable() {
makeMenuToggleTabbable();
makeMiniMapTabbable();
makeMenuToggleTabbable()
makeMiniMapTabbable()
makePanelsTabbable()
}

/**
Expand All @@ -25,7 +26,7 @@ function makeMenuToggleTabbable() {
}

/**
* Makes minimap tabbable and adds keyboard event listeners.
* Makes minimap tabbable and keyboard clickable
*/
function makeMiniMapTabbable() {
const quickButtonsContainer = document.getElementById('potree_quick_buttons');
Expand All @@ -40,4 +41,23 @@ function makeMiniMapTabbable() {
}
});
}
}

/**
* Makes accordion titles tabbable and keyboard clickable
*/
function makePanelsTabbable() {
const menu = document.getElementById('potree_menu');
if (menu) {
const headers = menu.querySelectorAll('h3');
headers.forEach((header) => {
header.tabIndex = 0;
header.addEventListener('keydown', (e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
header.click();
}
});
});
}
}

0 comments on commit 8189a40

Please sign in to comment.