Sidebar hierarchy and groups tab keyboard navigation - #2024
Conversation
19 new issues
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2024 +/- ##
=========================================
Coverage 70.42% 70.42%
Complexity 1703 1703
=========================================
Files 34 34
Lines 4436 4436
=========================================
Hits 3124 3124
Misses 1312 1312 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR improves sidebar accessibility by adding ARIA tree semantics and keyboard navigation for the Hierarchy and Groups tabs, supported by Cypress coverage.
Changes:
- Adds roving tabindex and arrow/Home/End/Space keyboard handling for hierarchy and group trees.
- Adds ARIA tree/treeitem/group attributes and removes focusability from visual expand buttons.
- Adds Cypress tests for keyboard navigation in both sidebar tabs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
resource/js/tab-hierarchy.js |
Adds tree semantics and keyboard navigation for hierarchy concepts. |
resource/js/tab-groups.js |
Adds tree semantics and keyboard navigation for group/member trees. |
tests/cypress/template/sidebar-hierarchy.cy.js |
Updates ARIA expectations and adds hierarchy keyboard navigation tests. |
tests/cypress/template/sidebar-groups.cy.js |
Updates ARIA expectations and adds groups keyboard navigation tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <a role="treeitem" | ||
| :class="{ 'selected': selectedConcept === concept.uri }" | ||
| :href="getConceptURL(concept.uri)" | ||
| :tabindex="concept.index === conceptInFocus ? 0 : -1" | ||
| :id="'hierarchy-concept' + concept.index" | ||
| :aria-expanded="concept.hasChildren ? concept.isOpen : null" | ||
| :aria-selected="concept.uri === selectedConcept" |
| <a role="treeitem" | ||
| :class="{ 'selected': selectedGroup === group.uri, 'group': group.isGroup }" | ||
| :href="getConceptURL(group.uri)" | ||
| :tabindex="group.index === conceptInFocus ? 0 : -1" | ||
| :id="'groups-concept' + group.index" | ||
| :aria-expanded="group.hasMembers ? group.isOpen : null" | ||
| :aria-selected="group.uri === selectedGroup" |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
osma
left a comment
There was a problem hiding this comment.
I tested this briefly in both Firefox and Chromium and also looked at the implementation, though not in great detail.
I think that the keyboard navigation in the hierarchy and groups feels very intuitive and natural. I'm not an expert on the details of the ARIA recommendations, but this is certainly a big step forward for accessibility!
SonarCloud pointed out that the use of counter++ within a sub-expression is bad practice, I think that could be fixed.
Other than that, LGTM!
Reasons for creating this PR
Hierarchy and groups tabs in the sidebar are not currently keyboard navigable. This PR adds keyboard navigation and screen reader semantics to both tabs.
Link to relevant issue(s), if any
Description of the changes in this PR
treeand links roletreeitemKnown problems or uncertainties in this PR
Checklist
.sr-onlyclass, color contrast)