-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Closed
Copy link
Labels
[Package] Admin UI/packages/admin-ui/packages/admin-ui[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
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
titleis typed asReact.ReactNode(line 26) - Note that
titleis passed directly asariaLabeltoNavigableRegion(line 37) - Open
packages/admin-ui/src/navigable-region/index.tsx - Note that
ariaLabelis typed asstring(line 17) and rendered asaria-labelon the DOM element (line 29) - Use the
Pagecomponent with a JSX title:<Page title={<><Icon /><span>My Page</span></>}> - Inspect the rendered DOM — the region element's
aria-labelis[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.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Package] Admin UI/packages/admin-ui/packages/admin-ui[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended