-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
[Package] Admin UI/packages/admin-ui/packages/admin-ui
Description
When using <Page> component from @wordpress/admin-ui package to build new pages, consumers might want to show some banding in the header next to the page name:
<Page
title={
<HStack alignment="center">
<Icon
icon={
<SVG>
<Path d="M5 4v3h5.5v12h3V7H19V4z" />
</SVG>
}
size={ 20 }
/>
My Plugin
</HStack>
}
subTitle={
__( 'Lorem ipsum dolor sit amet..', 'my-plugin' )
}
/>
...
</Page><Page> and its Header sub-component accepts React nodes in title just fine, so above will work:
| title?: React.ReactNode; |
| title?: React.ReactNode; |
However, when Page then passes the same title to navigable-region, it now expects String:
| <NavigableRegion className={ classes } ariaLabel={ title }> |
| ariaLabel: string; |
So the props are in conflict and we can't actually pass logos or other than strings as title.
Possible solutions:
- Make aria label optional and/or allow passing
accessibleTitlestring, which takes precedence overtitlefor navigable region: Admin UI: Fix type mismatch between Page title and NavigableRegion ariaLabel #75899 - Attempt to convert
titleto true string before passing to navigable region - Allow passing
icon(or similar name) to thePage. The Header component then controls symbol rendering, size and spacing, as well as within the Breadcrumbs navigation:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Package] Admin UI/packages/admin-ui/packages/admin-ui