Skip to content
Merged
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 @@ -17,6 +17,11 @@ and this project adheres to

- 🐛(backend) duplicate sub docs as root for reader users

### Changed

- ♿(frontend) improve accessibility:
- ✨ add document visible in list and openable via enter key #1365

## [3.7.0] - 2025-09-12

### Added
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Tooltip, useModal } from '@openfun/cunningham-react';
import { DateTime } from 'luxon';
import { KeyboardEvent } from 'react';
import { useTranslation } from 'react-i18next';
import { css } from 'styled-components';

Expand Down Expand Up @@ -33,6 +34,13 @@ export const DocsGridItem = ({ doc, dragMode = false }: DocsGridItemProps) => {
shareModal.open();
};

const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
(e.target as HTMLAnchorElement).click();
}
};

return (
<>
<Box
Expand All @@ -52,6 +60,9 @@ export const DocsGridItem = ({ doc, dragMode = false }: DocsGridItemProps) => {
}
`}
className="--docs--doc-grid-item"
aria-label={t('Open document: {{title}}', {
title: doc.title || t('Untitled document'),
})}
>
<Box
$flex={flexLeft}
Expand All @@ -68,6 +79,7 @@ export const DocsGridItem = ({ doc, dragMode = false }: DocsGridItemProps) => {
min-width: 0;
`}
href={`/docs/${doc.id}`}
onKeyDown={handleKeyDown}
>
<Box
data-testid={`docs-grid-name-${doc.id}`}
Expand Down
Loading