Description
The Page component in @wordpress/admin-ui accepts title as React.ReactNode, but passes it directly to NavigableRegion as the ariaLabel prop, which is typed as string and renders it as an aria-label DOM attribute.
If a caller passes JSX as title (e.g., a title with an icon), the aria-label attribute renders as [object Object], breaking accessibility for screen readers.
I expect aria-label to always contain a meaningful text string, or be omitted when a text string cannot be determined.
Step-by-step reproduction instructions
- Open
packages/admin-ui/src/page/index.tsx
- Note that
title is typed as React.ReactNode (line 26)
- Note that
title is passed directly as ariaLabel to NavigableRegion (line 37)
- Open
packages/admin-ui/src/navigable-region/index.tsx
- Note that
ariaLabel is typed as string (line 17) and rendered as aria-label on the DOM element (line 29)
- Use the
Page component with a JSX title: <Page title={<><Icon /><span>My Page</span></>}>
- Inspect the rendered DOM — the region element's
aria-label is [object Object]
// Current behavior — type mismatch allows this, but produces broken a11y
<Page title={<><MyIcon /><span>Dashboard</span></>}>
<Content />
</Page>
// Renders: <div aria-label="[object Object]" role="region" ...>
Environment info
- Gutenberg trunk (latest)
- This is a TypeScript type/API issue, not browser-specific
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
Description
The
Pagecomponent in@wordpress/admin-uiacceptstitleasReact.ReactNode, but passes it directly toNavigableRegionas theariaLabelprop, which is typed asstringand renders it as anaria-labelDOM attribute.If a caller passes JSX as
title(e.g., a title with an icon), thearia-labelattribute renders as[object Object], breaking accessibility for screen readers.I expect
aria-labelto always contain a meaningful text string, or be omitted when a text string cannot be determined.Step-by-step reproduction instructions
packages/admin-ui/src/page/index.tsxtitleis typed asReact.ReactNode(line 26)titleis passed directly asariaLabeltoNavigableRegion(line 37)packages/admin-ui/src/navigable-region/index.tsxariaLabelis typed asstring(line 17) and rendered asaria-labelon the DOM element (line 29)Pagecomponent with a JSX title:<Page title={<><Icon /><span>My Page</span></>}>aria-labelis[object Object]Environment info
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.