Skip to content

Commit

Permalink
chore: add a11y region for title of page
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcthms committed Nov 7, 2023
1 parent 636d133 commit e854106
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion polaris-react/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@
},
"Page": {
"Header": {
"rollupActionsLabel": "View actions for {title}"
"rollupActionsLabel": "View actions for {title}",
"pageReadyAccessibilityLabel": "{title}. This page is ready"
}
},
"Pagination": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ export function Header({
</div>
);

const pageReadyAccessibilityLabelMarkup = title ? (
<div role="status">
<Text visuallyHidden as="p">
{i18n.translate('pageReadyAccessibilityLabel', {title})}
</Text>
</div>
) : undefined;

const primaryActionMarkup = primaryAction ? (
<PrimaryActionMarkup primaryAction={primaryAction} />
) : null;
Expand Down Expand Up @@ -208,6 +216,7 @@ export function Header({
paddingInlineEnd={{xs: '400', sm: '0'}}
visuallyHidden={titleHidden}
>
{pageReadyAccessibilityLabelMarkup}
<div className={headerClassNames}>
<FilterActionsProvider filterActions={Boolean(filterActions)}>
<ConditionalRender
Expand Down

0 comments on commit e854106

Please sign in to comment.