Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ and this project adheres to
- 🐛(frontend) fix children not display when first resize #1753
- 🐛(frontend) fix clickable main content regression #1773

### Changed

- ♿(frontend) improve accessibility:
- ♿️(frontend) fix subdoc opening and emoji pick focus #1745

## [4.2.0] - 2025-12-17

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,23 @@ export const EmojiPicker = ({
}: EmojiPickerProps) => {
const { i18n } = useTranslation();

const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
if (event.key === 'Escape') {
onClickOutside();
}
};

const pickerContent = (
<Box $position="absolute" $zIndex={1000} $margin="2rem 0 0 0">
<Box
$position="absolute"
$zIndex={1000}
$margin="2rem 0 0 0"
onKeyDownCapture={handleKeyDown}
>
<Picker
data={emojiData}
locale={i18n.resolvedLanguage}
autoFocus
onClickOutside={onClickOutside}
onEmojiSelect={onEmojiSelect}
previewPosition="none"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@ const CalloutComponent = ({
<BoxButton
contentEditable={false}
onClick={toggleEmojiPicker}
onKeyDown={(e) => {
if (e.key === 'Escape' && openEmojiPicker) {
setOpenEmojiPicker(false);
}
}}
$css={css`
font-size: 1.125rem;
cursor: ${isEditable ? 'pointer' : 'default'};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
useTrans,
} from '@/docs/doc-management';
import { useLeftPanelStore } from '@/features/left-panel';
import { useKeyboardActivation } from '@/hooks/useKeyboardActivation';
import { useResponsiveStore } from '@/stores';

import SubPageIcon from './../assets/sub-page-logo.svg';
Expand Down Expand Up @@ -97,6 +98,7 @@ export const DocSubPageItem = (props: TreeViewNodeProps<Doc>) => {
const isDisabled = !!doc.deleted_at;
const actionsRef = useRef<HTMLDivElement>(null);
const buttonOptionRef = useRef<HTMLDivElement | null>(null);
const isActive = node.isFocused;

const handleKeyDown = (e: React.KeyboardEvent) => {
// F2: focus first action button
Expand All @@ -108,6 +110,14 @@ export const DocSubPageItem = (props: TreeViewNodeProps<Doc>) => {
}
};

useKeyboardActivation(
['Enter'],
isActive && !menuOpen,
handleActivate,
true,
'.c__tree-view',
);

Comment on lines +113 to +120
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think you need it anymore, this commit (suitenumerique/ui-kit@c121fdd#diff-69b4765cf5a180b5d5c2157eb0132487a6c0b7b7fb1dc379250ce110ac162e2eR27) adds onKeyDown, so here you can add directly what you need now.
You have to bump to the last ui-kit version though.

Copy link
Collaborator Author

@Ovgodd Ovgodd Jan 9, 2026

Choose a reason for hiding this comment

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

has talk together, waiting for updates on your side because change @gouvfr-lasuite/ui-kit": "0.18.4" to .5 or .6 seems to break

const handleActionsOpenChange = (isOpen: boolean) => {
setMenuOpen(isOpen);

Expand Down
1 change: 1 addition & 0 deletions src/frontend/apps/impress/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './useKeyboardAction';
export * from './useKeyboardActivation';
41 changes: 41 additions & 0 deletions src/frontend/apps/impress/src/hooks/useKeyboardActivation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { useEffect } from 'react';

export const useKeyboardActivation = (
keys: string[],
enabled: boolean,
action: () => void,
capture = false,
selector: string,
) => {
useEffect(() => {
if (!enabled) {
return;
}
const onKeyDown = (e: KeyboardEvent) => {
if (keys.includes(e.key)) {
// Ignore if focus is on interactive elements (emoji picker button, actions menu, etc.)
const target = e.target as HTMLElement | null;
if (
target?.closest('.--docs--doc-icon') ||
target?.closest('.light-doc-item-actions') ||
target?.closest('button') ||
target?.closest('[role="menu"]') ||
target?.closest('[role="menuitem"]')
) {
return;
}

e.preventDefault();
action();
}
};
const treeEl = document.querySelector<HTMLElement>(selector);
if (!treeEl) {
return;
}
treeEl.addEventListener('keydown', onKeyDown, capture);
return () => {
treeEl.removeEventListener('keydown', onKeyDown, capture);
};
}, [keys, enabled, action, capture, selector]);
};
2 changes: 1 addition & 1 deletion src/frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12518,7 +12518,7 @@ qified@^0.5.2:
dependencies:
hookified "^1.13.0"

qs@6.14.1, qs@^6.11.2, qs@^6.14.0:
qs@^6.11.2, qs@^6.14.0:
version "6.14.1"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.14.1.tgz#a41d85b9d3902f31d27861790506294881871159"
integrity sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==
Expand Down
Loading