️(frontend) ensure doc title is h1 for accessibility

Fix heading hierarchy when withTitle is false in production
This commit is contained in:
Cyril
2026-03-16 10:24:57 +01:00
parent c1998a9b24
commit 4cd72ffa4f
2 changed files with 34 additions and 31 deletions
+1
View File
@@ -35,6 +35,7 @@ and this project adheres to
- ⬆️(frontend) upgrade Next.js to v16 #1980
- ♿️(frontend) fix aria-label and landmark on document banner state #1986
- 🌐(i18n) add "new window" translation key for waffle aria-label #1984
- ♿️(frontend) ensure doc title is h1 for accessibility #2006
### Fixed
@@ -43,7 +43,7 @@ export const DocTitleText = () => {
return (
<Box className={CLASS_DOC_TITLE} $direction="row" $align="center">
<Text
as="h2"
as="h1"
$margin={{ all: 'none', left: 'none' }}
$size={isMobile ? 'h4' : 'h2'}
>
@@ -168,37 +168,39 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
{!isTopRoot && <DocTitleEmojiPicker doc={doc} />}
<Tooltip content={t('Rename')} aria-hidden={true} placement="top">
<Box
as="span"
role="textbox"
className="--docs--doc-title-input"
contentEditable
defaultValue={titleDisplay || undefined}
onKeyDownCapture={handleKeyDown}
suppressContentEditableWarning={true}
aria-label={`${t('Document title')}`}
aria-multiline={false}
onBlurCapture={(event) =>
handleTitleSubmit(event.target.textContent || '')
}
$padding={{ right: 'big' }}
$css={css`
&[contenteditable='true']:empty:not(:focus):before {
content: '${untitledDocument}';
color: var(
--c--contextuals--content--semantic--neutral--tertiary
);
pointer-events: none;
font-style: italic;
<Box as="h1" $margin="none">
<Box
as="span"
role="textbox"
className="--docs--doc-title-input"
contentEditable
defaultValue={titleDisplay || undefined}
onKeyDownCapture={handleKeyDown}
suppressContentEditableWarning={true}
aria-label={`${t('Document title')}`}
aria-multiline={false}
onBlurCapture={(event) =>
handleTitleSubmit(event.target.textContent || '')
}
font-size: ${isDesktop
? css`var(--c--globals--font--sizes--h2)`
: css`var(--c--globals--font--sizes--sm)`};
font-weight: 700;
outline: none;
`}
>
{titleDisplay}
$padding={{ right: 'big' }}
$css={css`
&[contenteditable='true']:empty:not(:focus):before {
content: '${untitledDocument}';
color: var(
--c--contextuals--content--semantic--neutral--tertiary
);
pointer-events: none;
font-style: italic;
}
font-size: ${isDesktop
? css`var(--c--globals--font--sizes--h2)`
: css`var(--c--globals--font--sizes--sm)`};
font-weight: 700;
outline: none;
`}
>
{titleDisplay}
</Box>
</Box>
</Tooltip>
</Box>