Repository navigation
feat(ou-tree): keyboard, focus and ARIA: one tab stop, treeview keys, inner focus, searchbox - #1792
Open
HendrikThePendric wants to merge 20 commits into
Open
HendrikThePendric wants to merge 20 commits into
HendrikThePendric wants to merge 20 commits into
Conversation
…iew moves A row key with its last index as the fallback, hasFocus set by the glue, isFocused for rows, and focusNext/Previous/First/Last/Parent/Child returning the new index. Every row is indexed by its key now. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… one Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… the provider aria-activedescendant needs element ids unique per tree on the page, and the search input needs a way to hand focus to the list's container. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…he click Every row is a treeitem now, skeleton rows busy and labelled, error rows labelled by their retry, each with an element id for aria-activedescendant and the focus ring while focused. The row shell takes the click, so the label and the toggle are plain spans; the eye and the retry buttons leave the tab order, reached by the row's inner focus. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…s for a row's controls The container is the tree's one tab stop and names the focused row with aria-activedescendant; the arrows, Home and End move it, Right and Left open, close and step between levels, Enter toggles. Shift+Enter moves DOM focus into the row's first control, Tab cycles the row's controls and Escape returns to the tree. Moves scroll the row into view. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Input already renders one; InputField did not pass it through, so an InputField could not be a searchbox. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…and Escape clears Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ads the rest from the tree The children status and the result flag came off the store and the search through the row; the row component already read them through useOuTreeNode. Row reuse is now key, depth and view. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…e it was focused Rows inserted above a focused row moved it; when its key then went, the fallback index pointed at an unrelated row far above. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Only the toggle is skipped for a click that was a button's, so the eye and the retry keep mouse and keyboard on the same row. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
With no rows, while the roots load or failed or a search has no results, the tab stop was invisible. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ght return from a control Tab cycles only within a row entered from the tree (its controls have tabIndex -1), so the roots retry, which is in the tab order, is left as usual. Left and Right pressed inside a control return to the tree and act. A move key without a focused row starts at the first visible row. Enter on a row that is not a node clicks its control, the retry. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… and closes it on click The old tree's line was the ancestor's toggle, spanning its subtree: hovering it lit the branch and clicking it collapsed the ancestor. The flat list draws a segment per row, so a guide is tree state now: the segment's ancestor and subtree are resolved once per change, each row reads its lit level, and a click on a lit segment closes the branch and focuses the ancestor. The focused row's parent branch is lit while the tree has focus, so the keyboard shows the branch too. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
HendrikThePendric
changed the base branch from
master
to
feat/paged-org-unit-tree
November 18, 2026 08:12
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…the label Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A literal tabIndex is what the activedescendant lint rule reads. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…tion exists Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ol and the row's Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Contributor
|
🚀 Deployed on https://pr-1792--dhis2-ui.netlify.app |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Implements DHIS2-21263 (client side, batch 5 of
OuTree). Base:feat/paged-org-unit-tree, after batch 4 (#1787).Description
OuTreeis operable from the keyboard and correct for assistive technology. Still over the stand-in, still not exported.aria-activedescendant, since rows scroll out of the DOM under virtualisation. Tab lands on the first visible row; the focused row shows the ring, the container none.tabIndex=-1) and rows with a control sayaria-keyshortcuts="Shift+Enter". Precedent: the W3C grid and treegrid patterns.focusedKeywith its last index as the fallback (a skeleton that became a node keeps the position),hasFocusset by the glue, the movesfocusNext/focusPrevious/focusFirst/focusLast/focusParent/focusChildreturning the new index so the list scrolls to it. The eye shows on the focused row as well as the hovered one. Hooks:useOuTreeNodeaddsisFocused; newuseOuTreeRowFocused,useOuTreeRowElementId,useOuTreeFocusTarget,useOuTreeRegisterFocusTarget;useOuTreeKeyboardin the list.treeitem, with an element id from the provider'streeId(unique per tree on the page): skeleton rows busy and labelled "Loading", error rows labelled by their retry. The row shell takes the click, so the label and the toggle are plain spans; a click on a button inside the row does not toggle it. This resolves the Sonar accessibility findings from batch 4.role="searchbox"(needsInputFieldto forwardrole: one prop added in@dhis2-ui/input), Down moves focus to the tree, Escape clears the search.grey500), click it to close the branch and focus its ancestor; the keyboard gets there with Left repeated. The focused row's parent branch is lit while the tree has focus, so arrowing through a deep branch shows which one you are in.useOuTreeNode, and row reuse is key, depth and view.Left for later: selection (next batch; it decides between Space on the row and a checkbox as an inner control),
aria-setsize/aria-posinset(a paged list does not know them), the roots rows' retry while the roots failed, which stays in the Tab order as it is not a tree row.Known issues
aria-activedescendantnames a row that may not be rendered yet right after a long jump; the virtualiser scrolls it into the DOM in the same tick.useVirtualizerremains, as in batch 3.Checklist
OuTreedescription)Screenshots
The
Searchstory over the PAHO stand-in, searchingclin: Catamarca focused from the keyboard with its eye; focus moved into the eye with Shift+Enter; End scrolled to the last row; a branch lit from its guide line.🤖 Generated with Claude Code