Skip to content

chore(page): updated examples to provide a11y labels #11741

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -535,16 +535,16 @@ export const NotificationDrawerBasic: React.FunctionComponent = () => {
breadcrumb={PageBreadcrumb}
mainContainerId={pageId}
>
<PageSection>
<PageSection aria-labelledby="main-title">
<Content>
<h1>Main title</h1>
<h1 id="main-title">Main title</h1>
<p>
Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because <br />
of its relative line height of 1.5.
</p>
</Content>
</PageSection>
<PageSection>Panel section content</PageSection>
<PageSection aria-label="Panel section content">Panel section content</PageSection>
</Page>
</Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,16 +770,16 @@ export const NotificationDrawerGrouped: React.FunctionComponent = () => {
breadcrumb={PageBreadcrumb}
mainContainerId={pageId}
>
<PageSection>
<PageSection aria-labelledby="main-title">
<Content>
<h1>Main title</h1>
<h1 id="main-title">Main title</h1>
<p>
Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because <br />
of its relative line height of 1.5.
</p>
</Content>
</PageSection>
<PageSection>Panel section content</PageSection>
<PageSection aria-label="Panel section content">Panel section content</PageSection>
</Page>
</Fragment>
);
Expand Down
4 changes: 2 additions & 2 deletions packages/react-core/src/demos/RTL/examples/PaginatedTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,9 @@ export const PaginatedTableAction = () => {
))}
</Breadcrumb>
</PageBreadcrumb>
<PageSection variant="light">
<PageSection variant="light" aria-labelledby='main-title' >
<Content>
<h1>{translation.title}</h1>
<h1 id='main-title'>{translation.title}</h1>
<p>{translation.body}</p>
</Content>
</PageSection>
Expand Down
4 changes: 2 additions & 2 deletions packages/react-core/src/demos/RTL/examples/PaginatedTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,9 @@ export const PaginatedTableAction: React.FunctionComponent = () => {
))}
</Breadcrumb>
</PageBreadcrumb>
<PageSection variant="light">
<PageSection variant="light" aria-labelledby="main-title">
<Content>
<h1>{translation.title}</h1>
<h1 id="main-title">{translation.title}</h1>
<p>{translation.body}</p>
</Content>
</PageSection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,13 @@ export const PageStickySectionBreadcrumb: React.FunctionComponent = () => {
mainContainerId={mainContainerId}
isBreadcrumbWidthLimited
>
<PageSection isWidthLimited>
<PageSection isWidthLimited aria-label="Main title">
<Content>
<Content component="h1">Main title</Content>
<Content component="p">This is a full page demo.</Content>
</Content>
</PageSection>
<PageSection isWidthLimited>
<PageSection isWidthLimited aria-label="Card gallery">
<Gallery hasGutter>
{Array.from({ length: 50 }).map((_value, index) => (
<GalleryItem key={index}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,13 @@ export const PageStickySectionBreadcrumb: React.FunctionComponent = () => {
}
}}
>
<PageSection isWidthLimited>
<PageSection isWidthLimited aria-labelledby="main-title">
<Content>
<h1>Main title</h1>
<h1 id="main-title">Main title</h1>
<p>This is a full page demo.</p>
</Content>
</PageSection>
<PageSection isWidthLimited>
<PageSection isWidthLimited aria-label="Card gallery">
<Gallery hasGutter>
{Array.from({ length: 50 }).map((_value, index) => (
<GalleryItem key={index}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ export const PageStickySectionGroup: React.FunctionComponent = () => {
isBreadcrumbWidthLimited
isBreadcrumbGrouped
additionalGroupedContent={
<PageSection isWidthLimited>
<PageSection isWidthLimited aria-labelledby="main-title">
<Content>
<h1>Main title</h1>
<h1 id="main-title">Main title</h1>
<p>This is a full page demo.</p>
</Content>
</PageSection>
Expand All @@ -289,7 +289,7 @@ export const PageStickySectionGroup: React.FunctionComponent = () => {
stickyOnBreakpoint: { default: 'top' }
}}
>
<PageSection>
<PageSection aria-label="Card gallery">
<Gallery hasGutter>
{Array.from({ length: 50 }).map((_value, index) => (
<GalleryItem key={index}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,14 @@ export const PageStickySectionGroupAlternate: React.FunctionComponent = () => {
</BreadcrumbItem>
</Breadcrumb>
</PageBreadcrumb>
<PageSection isWidthLimited>
<PageSection isWidthLimited aria-labelledby="main-title">
<Content>
<h1>Main title</h1>
<h1 id="main-title">Main title</h1>
<p>This is a full page demo.</p>
</Content>
</PageSection>{' '}
</PageGroup>
<PageSection>
<PageSection aria-label="Card gallery">
<Gallery hasGutter>
{Array.from({ length: 50 }).map((_value, index) => (
<GalleryItem key={index}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,19 +612,19 @@ export const PrimaryDetailCardView: React.FunctionComponent = () => {

return (
<DashboardWrapper mainContainerId="main-content-card-view-default-nav" breadcrumb={null}>
<PageSection>
<PageSection aria-labelledby="projects-heading">
<Content>
<h1>Projects</h1>
<h1 id="projects-heading">Projects</h1>
<p>This is a demo that showcases Patternfly cards.</p>
</Content>
</PageSection>
<PageSection isFilled padding={{ default: 'noPadding' }}>
<PageSection isFilled padding={{ default: 'noPadding' }} aria-label="Card filtering toolbar">
<Toolbar id="card-view-data-toolbar-group-types" clearAllFilters={onDelete}>
<ToolbarContent>{toolbarItems}</ToolbarContent>
</Toolbar>
<Divider component="div" />
</PageSection>
<PageSection isFilled padding={{ default: 'noPadding' }}>
<PageSection isFilled padding={{ default: 'noPadding' }} aria-label="Card content area">
<Drawer isExpanded={isDrawerExpanded} className={'pf-m-inline-on-2xl'}>
<DrawerContent panelContent={panelContent}>
<DrawerContentBody hasPadding>{drawerContent}</DrawerContentBody>
Expand All @@ -636,6 +636,7 @@ export const PrimaryDetailCardView: React.FunctionComponent = () => {
stickyOnBreakpoint={{ default: 'bottom' }}
padding={{ default: 'noPadding' }}
variant="light"
aria-label="Pagination controls"
>
<Pagination
itemCount={filtered.length}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,17 +417,17 @@ export const PrimaryDetailContentPadding: React.FunctionComponent = () => {

return (
<DashboardWrapper>
<PageSection>
<PageSection aria-labelledby="main-title">
<Content>
<h1>Main title</h1>
<h1 id="main-title">Main title</h1>
<p>
Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because <br />
of it's relative line height of 1.5.
</p>
</Content>
</PageSection>
<Divider component="div" />
<PageSection padding={{ default: 'noPadding' }}>
<PageSection padding={{ default: 'noPadding' }} aria-label="Drawer content section">
<Drawer isExpanded={isDrawerExpanded}>
<DrawerContent panelContent={panelContent} colorVariant="no-background">
<DrawerContentBody hasPadding>{drawerContent}</DrawerContentBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,17 @@ export const PrimaryDetailDataListInCard: React.FunctionComponent = () => {

return (
<DashboardWrapper>
<PageSection>
<PageSection aria-labelledby="main-title">
<Content>
<h1>Main title</h1>
<h1 id="main-title">Main title</h1>
<p>
Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because <br />
of it’s relative line height of 1.5.
</p>
</Content>
</PageSection>
<Divider component="div" />
<PageSection>
<PageSection aria-label="Card with drawer content">
<Card>
<Drawer isStatic isExpanded={isExpanded}>
<DrawerContent panelContent={panelContent}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,17 +417,17 @@ export const PrimaryDetailFullPage: React.FunctionComponent = () => {

return (
<DashboardWrapper mainContainerId="main-content-page-layout-default-nav">
<PageSection>
<PageSection aria-labelledby="main-title">
<Content>
<h1>Main title</h1>
<h1 id="main-title">Main title</h1>
<p>
Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because <br />
of it's relative line height of 1.5.
</p>
</Content>
</PageSection>
<Divider component="div" />
<PageSection padding={{ default: 'noPadding' }}>
<PageSection padding={{ default: 'noPadding' }} aria-label="Card with drawer content">
<Drawer isExpanded={isDrawerExpanded}>
<DrawerContent panelContent={panelContent}>
<DrawerContentBody>{drawerContent}</DrawerContentBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,17 +417,17 @@ export const PrimaryDetailInlineModifier: React.FunctionComponent = () => {

return (
<DashboardWrapper>
<PageSection>
<PageSection aria-labelledby="main-title">
<Content>
<h1>Main title</h1>
<h1 id="main-title">Main title</h1>
<p>
Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because <br />
of it's relative line height of 1.5.
</p>
</Content>
</PageSection>
<Divider component="div" />
<PageSection padding={{ default: 'noPadding' }}>
<PageSection padding={{ default: 'noPadding' }} aria-label="Card with drawer content">
<Drawer isExpanded={isDrawerExpanded} isInline>
<DrawerContent panelContent={panelContent}>
<DrawerContentBody>{drawerContent}</DrawerContentBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,17 @@ export const PrimaryDetailSimpleListInCard: React.FunctionComponent = () => {

return (
<DashboardWrapper>
<PageSection>
<PageSection aria-labelledby="main-title">
<Content>
<h1>Main title</h1>
<h1 id="main-title">Main title</h1>
<p>
Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because <br />
of it’s relative line height of 1.5.
</p>
</Content>
</PageSection>
<Divider component="div" />
<PageSection>
<PageSection aria-label="Card with drawer content">
<Card>
<Drawer isStatic isExpanded={isExpanded}>
<DrawerContent panelContent={panelContent}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ export const SkeletonCard: React.FunctionComponent = () => {
);
return (
<DashboardWrapper isBreadcrumbWidthLimited>
<PageSection isWidthLimited>
<PageSection isWidthLimited aria-label="Main title">
<Content component="h1">Main title</Content>
<Content component="p">This is a full page demo.</Content>
</PageSection>
<PageSection>
<PageSection aria-label="Card gallery">
<Gallery hasGutter>{Array.from({ length: 7 }).map((_value, index) => card(index))}</Gallery>
</PageSection>
</DashboardWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ export const ConsoleLogViewerToolbar: React.FC = () => {

return (
<DashboardWrapper sidebarNavOpen={!mobileView} onPageResize={onPageResize}>
<PageSection>
<PageSection aria-label="Log viewer controls">
<Toolbar id="log-viewer-toolbar" inset={{ default: 'insetNone' }}>
<ToolbarContent>{items}</ToolbarContent>
</Toolbar>
Expand Down
2 changes: 1 addition & 1 deletion packages/react-core/src/demos/examples/Wizard/InModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/Dashboard
export const WizardInModalDemo: React.FunctionComponent = () => (
<>
<DashboardWrapper hasPageTemplateTitle>
<PageSection isWidthLimited>
<PageSection isWidthLimited aria-label="Card gallery section">
<Gallery hasGutter>
{Array.from({ length: 10 }).map((_value, index) => (
<GalleryItem key={index}>
Expand Down
2 changes: 1 addition & 1 deletion packages/react-core/src/demos/examples/Wizard/InPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DashboardWrapper } from '@patternfly/react-core/src/demos/DashboardWrap
export const WizardFullPage: React.FunctionComponent = () => (
<Fragment>
<DashboardWrapper hasPageTemplateTitle>
<PageSection hasBodyWrapper={false} type={PageSectionTypes.wizard}>
<PageSection hasBodyWrapper={false} type={PageSectionTypes.wizard} aria-label="Wizard container">
<Wizard>
<WizardStep name="Information" id="wizard-step-1">
<p>Step 1 content</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ export const WizardFullPageWithDrawerDemo: React.FunctionComponent = () => {
breadcrumb={PageBreadcrumb}
mainContainerId={pageId}
>
<PageSection>
<PageSection aria-labelledby="main-title">
<Content>
<h1>Main title</h1>
<h1 id="main-title">Main title</h1>
<p>A demo of a wizard in a page.</p>
</Content>
</PageSection>
<PageSection hasBodyWrapper={false} type={PageSectionTypes.wizard}>
<PageSection hasBodyWrapper={false} type={PageSectionTypes.wizard} aria-label="Wizard container">
<Wizard>
<WizardStep body={{ hasNoPadding: true }} name="Information" id="wizard-step-1">
{createStepContentWithDrawer('Information step')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ export const WizardFullPageWithDrawerInfoStepDemo: React.FunctionComponent = ()
breadcrumb={PageBreadcrumb}
mainContainerId={pageId}
>
<PageSection>
<PageSection aria-labelledby="main-title">
<Content>
<h1>Main title</h1>
<h1 id="main-title">Main title</h1>
<p>A demo of a wizard in a page.</p>
</Content>
</PageSection>
<PageSection hasBodyWrapper={false} type={PageSectionTypes.wizard} ß>
<PageSection hasBodyWrapper={false} type={PageSectionTypes.wizard} ß aria-label="Wizard container">
<Wizard>
<WizardStep body={{ hasNoPadding: true }} name="Information" id="wizard-step-1">
{createStepContentWithDrawer('Information step')}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-table/src/demos/DashboardWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ export const DashboardBreadcrumb = (
);

const PageTemplateTitle = (
<PageSection>
<PageSection aria-labelledby="main-title">
<Content>
<h1>Main title</h1>
<h1 id="main-title">Main title</h1>
<p>This is a full page demo.</p>
</Content>
</PageSection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const TableBulkSelect: React.FunctionComponent = () => {

return (
<DashboardWrapper hasPageTemplateTitle>
<PageSection isWidthLimited>
<PageSection isWidthLimited aria-label="Bulk select table data">
{toolbar}
<Table aria-label="Selectable table">
<Thead>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ export const TableColumnManagement: React.FunctionComponent = () => {
return (
<Fragment>
<DashboardWrapper hasPageTemplateTitle>
<PageSection isFilled>
<PageSection isFilled aria-label="Column management table data">
{toolbarItems}
<Table variant="compact" aria-label="Column Management Table">
<Thead>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ export const TableColumnManagement: React.FunctionComponent = () => {
return (
<Fragment>
<DashboardWrapper hasPageTemplateTitle>
<PageSection isFilled>
<PageSection isFilled aria-label="Draggable Column Management table data">
{toolbarItems}
<Table variant="compact" aria-label="Column Management Table">
<Thead>
Expand Down
2 changes: 1 addition & 1 deletion packages/react-table/src/demos/examples/TableCompact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const TableCompact: React.FunctionComponent = () => {
return (
<Fragment>
<DashboardWrapper hasPageTemplateTitle>
<PageSection isFilled>
<PageSection isFilled aria-label="Compact table data">
<Card>
{tableToolbar}
<Table variant="compact" aria-label="Compact Table">
Expand Down
Loading
Loading