From 3d45c7c215a28e851de3920f0e584e105a646216 Mon Sep 17 00:00:00 2001 From: Cyril Date: Wed, 29 Oct 2025 10:41:40 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(frontend)=20improve=20accessibility?= =?UTF-8?q?=20and=20styling=20of=20summary=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit adds semantic structure, aria attributes, and token-based focus styling Signed-off-by: Cyril --- CHANGELOG.md | 1 + .../doc-table-content/components/Heading.tsx | 15 +++- .../components/TableContent.tsx | 80 +++++++++++++++---- 3 files changed, 77 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 279ab14ea9..152a39463e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to - ♿(frontend) improve accessibility: - ♿(frontend) improve ARIA in doc grid and editor for a11y #1519 + - ♿(frontend) improve accessibility and styling of summary table #1528 - 🐛(docx) fix image overflow by limiting width to 600px during export #1525 - 🐛(frontend) preserve @ character when esc is pressed after typing it #1512 diff --git a/src/frontend/apps/impress/src/features/docs/doc-table-content/components/Heading.tsx b/src/frontend/apps/impress/src/features/docs/doc-table-content/components/Heading.tsx index e069d92c3c..a7c1fcfc0b 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-table-content/components/Heading.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-table-content/components/Heading.tsx @@ -1,4 +1,5 @@ import { useState } from 'react'; +import { css } from 'styled-components'; import { BoxButton, Text } from '@/components'; import { useCunninghamTheme } from '@/cunningham'; @@ -40,7 +41,6 @@ export const Heading = ({ setIsHover(true)} onMouseLeave={() => setIsHover(false)} onClick={() => { @@ -59,8 +59,19 @@ export const Heading = ({ }} $radius="4px" $background={isActive ? `${colorsTokens['greyscale-100']}` : 'none'} - $css="text-align: left;" + $css={css` + text-align: left; + &:focus-visible { + /* Scoped focus style: same footprint as hover, with theme shadow */ + outline: none; + box-shadow: 0 0 0 2px ${colorsTokens['primary-400']}; + border-radius: 4px; + } + `} className="--docs--table-content-heading" + aria-label={text} + aria-selected={isHighlight} + aria-current={isHighlight ? 'true' : undefined} > { const { headings } = useHeadingStore(); const { editor } = useEditorStore(); - const { spacingsTokens } = useCunninghamTheme(); + const { spacingsTokens, colorsTokens } = useCunninghamTheme(); const [headingIdHighlight, setHeadingIdHighlight] = useState(); @@ -99,33 +99,62 @@ export const TableContent = () => { return ( {!isHover && ( - - + + )} {isHover && ( @@ -134,10 +163,11 @@ export const TableContent = () => { $overflow="hidden" $css={css` user-select: none; + padding: ${spacingsTokens['4xs']}; `} > { onClick={onClose} $justify="center" $align="center" + aria-label={t('Summary')} + aria-expanded={isHover} + aria-controls="toc-list" $css={css` + transition: none !important; transform: rotate(180deg); + &:focus-visible { + outline: none; + box-shadow: 0 0 0 2px ${colorsTokens['primary-400']}; + border-radius: 4px; + } `} > {headings?.map( (heading) => heading.contentText && ( - + + + ), )}