fix(VTreeview): more aria attributes and correct keyboard navigation#22903
fix(VTreeview): more aria attributes and correct keyboard navigation#22903J-Sek wants to merge 11 commits into
Conversation
|
Test with Accessibility Insights for Web now has another issue, see comment below. ========================================================================= Title: WCAG 4.1.2: Ensure buttons have discernible text (.v-btn.v-btn--icon.v-btn--density-compact) Issue: Ensure buttons have discernible text (button-name - https://accessibilityinsights.io/info-examples/web/button-name) Target application: Vuetify Dev Playground - http://localhost:8090/ Element path: #v-list-group--id-1 > .v-list-item__prepend > .v-list-item-action.v-list-item-action--start > .v-btn.v-btn--icon.v-btn--density-compact Snippet: How to fix: Environment: Chrome version 149.0.0.0 ==== This accessibility issue was found using Accessibility Insights for Web 2.47.0 (axe-core 4.11.3), a tool that helps find and fix accessibility issues. Get more information & download this tool at http://aka.ms/AccessibilityInsights. |
|
The buttons have tabindex -1, so they are not reachable, and is ok. They need to have |
|
If you set If i navigate the tree with arrows, screen reader never tells me that Child1 or Grandchild are selectable items. Screen reader is orca from Ubuntu. The following is partially AI generated:
|
|
Is there any UI library that ships tree component with such extensive labels? I am trying to align with react-aria that does not pollute labels with selection status, but it also has selection strategy equivalent to the "independent", so it is semantically a selection list and does not really need them. Just curious. Is it something you'd use or are we trying to satisfy the a11y requirements without consulting with actual end users? |
|
Having to comply with the EAA regulations from the EU directive. However the solution I have proposed was written by AI, so I don't know... =============== Non related, addendum The simple solution I use for now is this: Note that when this pr is merged this code conflicts with its new aria attributes. edited: 11 July import { nextTick, onMounted } from 'vue';
/**
* Workaround to fix/hide treeview accessibility issues.
*/
export function useTreeviewAccessibilityFix() {
const treeviewAccessibilityFix = () => {
nextTick(() => {
// Fix missing aria-labels for treeview checkboxes
const checkboxes = document.querySelectorAll('.v-treeview-item input[type="checkbox"]');
checkboxes.forEach((checkbox, index) => {
const item = checkbox.closest('.v-treeview-item');
const title = item?.querySelector('.v-treeview-item__title')?.textContent || `item ${index + 1}`;
checkbox.setAttribute('aria-label', `Select ${title}`);
});
// Fix missing aria-labels for treeview expand/collapse buttons
const expandButtons = document.querySelectorAll('.v-treeview-item .v-btn--icon');
expandButtons.forEach((button) => {
if (!button.getAttribute('aria-label')) {
const item = button.closest('.v-treeview-item');
const title = item?.querySelector('.v-treeview-item__title')?.textContent || 'item';
button.setAttribute('aria-label', `Expand/Collapse ${title}`);
}
});
});
};
onMounted(treeviewAccessibilityFix);
} |
|
any new news/ideas? |
|
Still cooking
It will need to land in |
- aria-level/posinset/setsize - aria-expanded only for expandable nodes - ArrowLeft/Right collapse/expand and move focus to parent/child (RTL-aware) - toggle button gets tabindex=-1 so the row owns expansion
28cb511 to
bb38a32
Compare
|
Everything seems ok, for me it can go. |
tabindex=-1so the row owns expansionresolves #10796
resolves #21585
Markup: