Skip to content

Conversation

@Ovgodd
Copy link
Collaborator

@Ovgodd Ovgodd commented Dec 2, 2025

Purpose

Improve keyboard accessibility for the document tree by implementing F2 navigation to access action buttons (three dots menu and add child button) for both root items and sub-pages.

issues : 1160

Enregistrement.de.l.ecran.2025-12-02.131853.mp4

Proposal

Keyboard Navigation

Key Context Action
Tab Document tree Navigate between documents (root → sub-pages)
F2 Focused document Move focus to first action button (three dots)
Enter Focused document Open the document
Enter Action button Activate button (open menu / create child)
Arrow Left/Right Action buttons Navigate between buttons
Escape Action buttons Return focus to document

Changes

  • Use ref to handle focus
  • Display actions when document is focused (like hover)
  • Hide document focus outline when focus is on actions

Accessibility

  • ✅ Actions are visible when document is focused (keyboard users see them)
  • ✅ Actions are not in tab order (reduces tab stops)
  • ✅ F2 is the standard key for accessing toolbars (ARIA best practices)
  • ✅ Arrow keys for navigation within toolbar (ARIA roving tabindex pattern)
  • ✅ Escape returns to main content (standard pattern)
  • ✅ Screen reader announces keyboard shortcuts (F2, arrows, Enter) when entering the tree

@Ovgodd Ovgodd requested a review from AntoLC December 2, 2025 12:22
@Ovgodd Ovgodd self-assigned this Dec 2, 2025
@Ovgodd Ovgodd changed the title Fix/a11y doctree options ♿️Improve keyboard accessibility for the document tree Dec 2, 2025
@Ovgodd Ovgodd force-pushed the fix/a11y-doctree-options branch from c49c1f7 to f72df6c Compare December 2, 2025 12:25
@github-actions
Copy link

github-actions bot commented Dec 2, 2025

Size Change: +709 B (+0.02%)

Total Size: 4.11 MB

Filename Size Change
apps/impress/out/_next/static/19adfceb/_buildManifest.js 0 B -906 B (removed) 🏆
apps/impress/out/_next/static/a2a7207e/_buildManifest.js 904 B +904 B (new file) 🆕

compressed-size-action

@Ovgodd Ovgodd force-pushed the fix/a11y-doctree-options branch 2 times, most recently from 5f35f48 to 2914ea9 Compare December 2, 2025 12:39
@Ovgodd Ovgodd marked this pull request as ready for review December 2, 2025 13:23
@Ovgodd Ovgodd force-pushed the fix/a11y-doctree-options branch from 2480747 to 86d98f0 Compare December 2, 2025 13:30
@Ovgodd Ovgodd force-pushed the fix/a11y-doctree-options branch from 9504a1c to fa7d602 Compare December 3, 2025 09:48
@Ovgodd Ovgodd requested a review from AntoLC December 3, 2025 11:51
@Ovgodd Ovgodd force-pushed the fix/a11y-doctree-options branch 3 times, most recently from 7d22f33 to cf8e1d5 Compare December 3, 2025 12:09
Copy link
Collaborator

@AntoLC AntoLC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the problem about the double f2, it is intercepted by treeitem.

Image

It positions the focus on the emojipicker ^^ If you do f2 then enter, the picker open.

I suppose it is not the best that :
https://github.com/suitenumerique/ui-kit/blob/0b6f80100a85641c8227b4a61720722ec12691e2/src/components/tree-view/TreeView.tsx#L351-L359
From here: suitenumerique/ui-kit@c40f7f6

We need a way to pass props easily to this part, if we can have the hand on props.attr we should be able to add our own onKeyDown, but for that we need to move this line (l378 {...props.attrs}) to the line under onKeyDown (l390).(https://github.com/suitenumerique/ui-kit/blob/0b6f80100a85641c8227b4a61720722ec12691e2/src/components/tree-view/TreeView.tsx#L378-L379).

adds f2 shortcut to open options menu in sub-documents

Signed-off-by: Cyril <c.gromoff@gmail.com>
…treeview struct

Signed-off-by: Cyril <c.gromoff@gmail.com>
improves screen reader support with contextual accessibility guidance

Signed-off-by: Cyril <c.gromoff@gmail.com>
@Ovgodd Ovgodd force-pushed the fix/a11y-doctree-options branch from c109288 to 3a477ae Compare December 8, 2025 00:11
@Ovgodd
Copy link
Collaborator Author

Ovgodd commented Dec 8, 2025

I found the problem about the double f2, it is intercepted by treeitem.

Image It positions the focus on the emojipicker ^^ If you do `f2` then enter, the picker open.

I suppose it is not the best that : https://github.com/suitenumerique/ui-kit/blob/0b6f80100a85641c8227b4a61720722ec12691e2/src/components/tree-view/TreeView.tsx#L351-L359 From here: suitenumerique/ui-kit@c40f7f6

We need a way to pass props easily to this part, if we can have the hand on props.attr we should be able to add our own onKeyDown, but for that we need to move this line (l378 {...props.attrs}) to the line under onKeyDown (l390).(https://github.com/suitenumerique/ui-kit/blob/0b6f80100a85641c8227b4a61720722ec12691e2/src/components/tree-view/TreeView.tsx#L378-L379).

Ohhh it’s a really nice catch, I don’t know how I missed that the first F2 actually opens the emoji picker.

When I built this feature I only thought about the emoji picker later, so this is actually perfect, because we do need to be able to access it with the keyboard.

For your suggestion on the ui-kit side (moving {...props.attrs} below the onKeyDown in TreeView.tsx), I agree that the clean solution is to handle F2 directly in the row via onKeyDown instead of relying on workarounds here.

If I may, I propose to make some little fixup anyway ? because we have an accessibility audit coming very soon, and updating the ui-kit + bumping it in this on docs will probably take a bit of time ?

  • first F2 moves focus (visually as well) to the emoji button when available
  • second F2 moves focus to the document actions
  • the SR announcement is updated to describe this behavior

Once the ui-kit exposes onKeyDown properly on the tree row, I’d be happy to follow up with another PR to remove this workaround and align the behavior with the upstream TreeView.

ensures F2 correctly focuses the expected UI element

Signed-off-by: Cyril <c.gromoff@gmail.com>
@Ovgodd Ovgodd force-pushed the fix/a11y-doctree-options branch from 20af1c0 to 996f9ad Compare December 8, 2025 02:01
@Ovgodd Ovgodd requested a review from AntoLC December 8, 2025 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants