About this set
Two file explorers that follow the WAI-ARIA tree view pattern. Project explorer shows a SvelteKit repository with folder icons that swap between closed and open, coloured file-type icons and a footer that shows the path of the selected file. Shared drive with file sizes is a team drive with item counts on folders and sizes on files. The markup is a list with role tree, list items with role treeitem and nested lists with role group; folders carry aria-expanded and files carry aria-selected. A short vanilla JavaScript block adds the keyboard model: one tab stop per tree with a roving tabindex, Up and Down to move, Right to open a folder or step into it, Left to close it or step out to the parent, Home and End, type-ahead on the first letters of a name, Enter or Space to open a folder or select a file, and asterisk to open every sibling folder. Rows are indented with a depth custom property, so hover and selection colours span the full width as in a desktop file manager. Icons are inline SVG symbols referenced with use.
What’s included
- WAI-ARIA tree with role tree, treeitem and group
- Roving tabindex, arrow keys, Home and End, type-ahead, Enter and Space
- Folder icons that change when a folder opens, coloured file-type icons
- Selected path written to a polite live region
- Full-width selection rows indented by a --d depth variable
- Inline SVG sprite, no icon font or library
Accessibility
Each tree has an aria-label and exposes level, position and expanded state through the tree roles, and the selected file is marked with aria-selected. Only one item per tree is in the tab order and the arrow keys move between visible items. The focused row shows a 2px blue outline, and the chevron rotation stops under prefers-reduced-motion.
Customise it
Set --ft-sel, --ft-sel-text, --ft-hover, --ft-focus and --ft-indent on .ft, and change the .c-* classes for icon colours. In Tailwind edit the bg-, text- and outline- colours in the row's arbitrary state variants such as [[aria-selected=true]>&]:bg-[#e6efff].






