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: +687 B (+0.02%)

Total Size: 4.11 MB

Filename Size Change
apps/impress/out/_next/static/2f9e90ce/_buildManifest.js 0 B -906 B (removed) 🏆
apps/impress/out/_next/static/53b6db14/_buildManifest.js 905 B +905 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
opacity: 1;
}
}
/* Retirer le focus visuel du root item quand le focus est sur les actions */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/* Retirer le focus visuel du root item quand le focus est sur les actions */
/* Remove visual focus from the root item when focus is on the actions */

display: flex;
}
}
/* Retirer le focus visuel du tree item quand le focus est sur les actions */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Comments should be in english.

onOpenChange={onOpenChange}
>
<Icon
<Box
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about BoxButton ?

document.addEventListener('keydown', toActions, true);
return () => document.removeEventListener('keydown', toActions, true);
// node is a dependency, as it's checked for focus state
}, [node]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
}, [node]);
}, [node?.isFocused]);

Comment on lines 19 to 27
if (e.key !== 'F2' || document.querySelector(SELECTORS.MODAL)) {
return;
}

// Only react if the node is currently focused
if (!node?.isFocused) {
return;
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not fond of coupling with dom-selectors. If a modal is opened I suppose the node would not be focused anymore, so is it not enough that ?

Suggested change
if (e.key !== 'F2' || document.querySelector(SELECTORS.MODAL)) {
return;
}
// Only react if the node is currently focused
if (!node?.isFocused) {
return;
}
if (e.key !== 'F2' || !node?.isFocused) {
return;
}

@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
adds f2 shortcut to open options menu in sub-documents

Signed-off-by: Cyril <[email protected]>
@Ovgodd Ovgodd force-pushed the fix/a11y-doctree-options branch 2 times, most recently from b177dfa to 7d22f33 Compare December 3, 2025 12:07
@Ovgodd Ovgodd force-pushed the fix/a11y-doctree-options branch from 7d22f33 to cf8e1d5 Compare December 3, 2025 12:09
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