️(frontend) fix subdoc opening and emoji pick focus

ensures subdoc opens and emoji picker focus on input

Signed-off-by: Cyril <c.gromoff@gmail.com>
This commit is contained in:
Cyril
2025-12-17 14:07:24 +01:00
parent 2f52dddc84
commit 68df717854
4 changed files with 42 additions and 6 deletions

View File

@@ -14,6 +14,11 @@ and this project adheres to
- ✅(e2e) fix e2e test for other browsers #1799
### Changed
- ♿(frontend) improve accessibility:
- ♿️(frontend) fix subdoc opening and emoji pick focus #1745
## [4.4.0] - 2026-01-13
### Added

View File

@@ -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"

View File

@@ -106,11 +106,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'};

View File

@@ -128,6 +128,27 @@ export const DocTree = ({ currentDoc }: DocTreeProps) => {
}
}, []);
const handleRowKeyDown = useCallback((e: React.KeyboardEvent) => {
if (e.key !== 'Enter') {
return;
}
const target = e.target as HTMLElement | null;
if (
!target ||
!(
target.classList.contains('c__tree-view--row') ||
target.classList.contains('c__tree-view--node')
)
) {
return;
}
e.currentTarget
.querySelector<HTMLDivElement>('.c__tree-view--node')
?.click();
}, []);
/**
* This effect is used to reset the tree when a new document
* that is not part of the current tree is loaded.
@@ -357,6 +378,9 @@ export const DocTree = ({ currentDoc }: DocTreeProps) => {
}}
rootNodeId={treeContext.root.id}
renderNode={DocSubPageItem}
rowProps={{
onKeyDown: handleRowKeyDown,
}}
/>
</Overlayer>
)}