From c2eefb8bbfba3cc5563563708cd11a20e535bf67 Mon Sep 17 00:00:00 2001 From: Divyanshu Gupta Date: Thu, 3 Apr 2025 19:47:13 +0530 Subject: [PATCH 1/8] chore(page): updated examples to provide a11y labels --- .../Page/examples/PageCenteredSection.tsx | 2 +- .../components/Page/examples/PageGroupSection.tsx | 6 +++--- .../components/Page/examples/PageHorizontalNav.tsx | 8 +++++--- .../Page/examples/PageMainSectionPadding.tsx | 14 ++++++++++---- .../Page/examples/PageMainSectionVariations.tsx | 12 ++++++------ .../Page/examples/PageMultipleSidebarBody.tsx | 6 +++--- .../Page/examples/PageUncontrolledNav.tsx | 6 +++--- .../components/Page/examples/PageVerticalNav.tsx | 8 +++++--- .../Page/examples/PageWithOrWithoutFill.tsx | 6 +++--- 9 files changed, 39 insertions(+), 29 deletions(-) diff --git a/packages/react-core/src/components/Page/examples/PageCenteredSection.tsx b/packages/react-core/src/components/Page/examples/PageCenteredSection.tsx index b475f1da08d..113ac60fff2 100644 --- a/packages/react-core/src/components/Page/examples/PageCenteredSection.tsx +++ b/packages/react-core/src/components/Page/examples/PageCenteredSection.tsx @@ -68,7 +68,7 @@ export const PageCenteredSection: React.FunctionComponent = () => { return ( - + When a width limited page section is wider than the value of diff --git a/packages/react-core/src/components/Page/examples/PageGroupSection.tsx b/packages/react-core/src/components/Page/examples/PageGroupSection.tsx index 4c113527085..11f4fe0e11f 100644 --- a/packages/react-core/src/components/Page/examples/PageGroupSection.tsx +++ b/packages/react-core/src/components/Page/examples/PageGroupSection.tsx @@ -101,10 +101,10 @@ export const PageGroupSection: React.FunctionComponent = () => { - Grouped section + Grouped section - Section 1 - Section 2 + Section 1 + Section 2 ); }; diff --git a/packages/react-core/src/components/Page/examples/PageHorizontalNav.tsx b/packages/react-core/src/components/Page/examples/PageHorizontalNav.tsx index bb3b4b44d42..eb31781a76a 100644 --- a/packages/react-core/src/components/Page/examples/PageHorizontalNav.tsx +++ b/packages/react-core/src/components/Page/examples/PageHorizontalNav.tsx @@ -36,9 +36,11 @@ export const PageHorizontalNav: React.FunctionComponent = () => { return ( - Section 1 - Section 2 with secondary variant styling - Section 3 + Section 1 + + Section 2 with secondary variant styling + + Section 3 ); }; diff --git a/packages/react-core/src/components/Page/examples/PageMainSectionPadding.tsx b/packages/react-core/src/components/Page/examples/PageMainSectionPadding.tsx index 96eabf69958..b91a1daa9f3 100644 --- a/packages/react-core/src/components/Page/examples/PageMainSectionPadding.tsx +++ b/packages/react-core/src/components/Page/examples/PageMainSectionPadding.tsx @@ -64,10 +64,16 @@ export const PageMainSectionPadding: React.FunctionComponent = () => { return ( - Section with default padding - Section with no padding - Section with padding on medium - Section with no padding on medium + Section with default padding + + Section with no padding + + + Section with padding on medium + + + Section with no padding on medium + ); }; diff --git a/packages/react-core/src/components/Page/examples/PageMainSectionVariations.tsx b/packages/react-core/src/components/Page/examples/PageMainSectionVariations.tsx index a510177e9d3..f3829fb2e57 100644 --- a/packages/react-core/src/components/Page/examples/PageMainSectionVariations.tsx +++ b/packages/react-core/src/components/Page/examples/PageMainSectionVariations.tsx @@ -64,22 +64,22 @@ export const PageMainSectionPadding: React.FunctionComponent = () => { return ( - + Section with type="subnav" for horizontal subnav navigation - + Section with type="nav" for tertiary navigation - + Section with type="tabs" for tabs - + Section with type="breadcrumb" for breadcrumbs - + Section without type prop or type="default" for main sections - + Section with type="wizard" for wizards diff --git a/packages/react-core/src/components/Page/examples/PageMultipleSidebarBody.tsx b/packages/react-core/src/components/Page/examples/PageMultipleSidebarBody.tsx index 9b4943792bb..df750e53384 100644 --- a/packages/react-core/src/components/Page/examples/PageMultipleSidebarBody.tsx +++ b/packages/react-core/src/components/Page/examples/PageMultipleSidebarBody.tsx @@ -71,9 +71,9 @@ export const PageMultipleSidebarBody: React.FunctionComponent = () => { return ( - Section 1 - Section 2 - Section 3 + Section 1 + Section 2 + Section 3 ); }; diff --git a/packages/react-core/src/components/Page/examples/PageUncontrolledNav.tsx b/packages/react-core/src/components/Page/examples/PageUncontrolledNav.tsx index 716246d5302..438dbc530a3 100644 --- a/packages/react-core/src/components/Page/examples/PageUncontrolledNav.tsx +++ b/packages/react-core/src/components/Page/examples/PageUncontrolledNav.tsx @@ -51,9 +51,9 @@ export const PageUncontrolledNav: React.FunctionComponent = () => { return ( - Section 1 - Section 2 - Section 3 + Section 1 + Section 2 + Section 3 ); }; diff --git a/packages/react-core/src/components/Page/examples/PageVerticalNav.tsx b/packages/react-core/src/components/Page/examples/PageVerticalNav.tsx index f14baa5cc15..93484377423 100644 --- a/packages/react-core/src/components/Page/examples/PageVerticalNav.tsx +++ b/packages/react-core/src/components/Page/examples/PageVerticalNav.tsx @@ -64,9 +64,11 @@ export const PageVerticalNav: React.FunctionComponent = () => { return ( - Section 1 - Section 2 with secondary variant styling - Section 3 + Section 1 + + Section 2 with secondary variant styling + + Section 3 ); }; diff --git a/packages/react-core/src/components/Page/examples/PageWithOrWithoutFill.tsx b/packages/react-core/src/components/Page/examples/PageWithOrWithoutFill.tsx index 10286dc1fc5..2c0c9bb23a5 100644 --- a/packages/react-core/src/components/Page/examples/PageWithOrWithoutFill.tsx +++ b/packages/react-core/src/components/Page/examples/PageWithOrWithoutFill.tsx @@ -64,11 +64,11 @@ export const PageWithOrWithoutFill: React.FunctionComponent = () => { return ( - A default page section - + A default page section + This section fills the available space. - A default page section + A default page section ); }; From d1fd5f00422d5e9bc31263f0ae3db78371bf31bd Mon Sep 17 00:00:00 2001 From: Divyanshu Gupta Date: Fri, 4 Apr 2025 16:13:18 +0530 Subject: [PATCH 2/8] added a11y labels to examples --- packages/react-core/src/demos/Banner.md | 12 ++++++------ .../src/demos/CardView/examples/CardView.tsx | 13 +++++++++---- .../demos/DataList/examples/DataListActionable.tsx | 4 ++-- .../src/demos/DataList/examples/DataListBasic.tsx | 4 ++-- .../examples/DataListExpandableControlInToolbar.tsx | 4 ++-- .../examples/DataListStaticBottomPagination.tsx | 2 +- .../examples/DescriptionListBasic.tsx | 4 ++-- .../examples/DescriptionListInDrawer.tsx | 4 ++-- packages/react-core/src/demos/JumpLinks.md | 8 ++++---- packages/react-core/src/demos/Tabs.md | 12 ++++++------ .../src/demos/examples/Tabs/ModalTabs.tsx | 6 +++--- .../src/demos/examples/Tabs/NestedTabs.tsx | 4 ++-- .../demos/examples/Tabs/NestedUnindentedTabs.tsx | 4 ++-- .../src/demos/examples/Tabs/TabsAndTable.tsx | 4 ++-- 14 files changed, 45 insertions(+), 40 deletions(-) diff --git a/packages/react-core/src/demos/Banner.md b/packages/react-core/src/demos/Banner.md index 7bf37f2dbef..7f716f08e44 100644 --- a/packages/react-core/src/demos/Banner.md +++ b/packages/react-core/src/demos/Banner.md @@ -39,16 +39,16 @@ class BannerDemo extends React.Component { return ( - + -

Main title

+

Main title

Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because
of it’s relative line height of 1.5.

- + {Array.from({ length: 30 }).map((_value, index) => ( @@ -112,9 +112,9 @@ class BannerDemo extends React.Component { - + -

Main title

+

Main title

Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because{' '}
@@ -122,7 +122,7 @@ class BannerDemo extends React.Component {

- + {Array.from({ length: 30 }).map((_value, index) => ( diff --git a/packages/react-core/src/demos/CardView/examples/CardView.tsx b/packages/react-core/src/demos/CardView/examples/CardView.tsx index d28cf150a52..f2843ab059d 100644 --- a/packages/react-core/src/demos/CardView/examples/CardView.tsx +++ b/packages/react-core/src/demos/CardView/examples/CardView.tsx @@ -465,16 +465,16 @@ export const CardViewBasic: React.FunctionComponent = () => { return ( - + -

Projects

+

Projects

This is a demo that showcases PatternFly cards.

{toolbarItems}
- + @@ -546,7 +546,12 @@ export const CardViewBasic: React.FunctionComponent = () => { ))} - + { return ( - + Projects This is a demo that showcases PatternFly Data List - + {!isDeleted && ( diff --git a/packages/react-core/src/demos/DataList/examples/DataListBasic.tsx b/packages/react-core/src/demos/DataList/examples/DataListBasic.tsx index cd9cf0594e8..c1029caa57f 100644 --- a/packages/react-core/src/demos/DataList/examples/DataListBasic.tsx +++ b/packages/react-core/src/demos/DataList/examples/DataListBasic.tsx @@ -69,9 +69,9 @@ export const DataListBasic: React.FunctionComponent = () => { return ( - + -

Projects

+

Projects

This is a demo that showcases PatternFly data list

diff --git a/packages/react-core/src/demos/DataList/examples/DataListExpandableControlInToolbar.tsx b/packages/react-core/src/demos/DataList/examples/DataListExpandableControlInToolbar.tsx index 503d731bdd1..7f41c17781b 100644 --- a/packages/react-core/src/demos/DataList/examples/DataListExpandableControlInToolbar.tsx +++ b/packages/react-core/src/demos/DataList/examples/DataListExpandableControlInToolbar.tsx @@ -133,9 +133,9 @@ export const DataListExpandableControlInToolbar: React.FunctionComponent = () => return ( - + -

Projects

+

Projects

This is a demo that showcases PatternFly data list

diff --git a/packages/react-core/src/demos/DataList/examples/DataListStaticBottomPagination.tsx b/packages/react-core/src/demos/DataList/examples/DataListStaticBottomPagination.tsx index df6916d24c6..bf187b61acc 100644 --- a/packages/react-core/src/demos/DataList/examples/DataListStaticBottomPagination.tsx +++ b/packages/react-core/src/demos/DataList/examples/DataListStaticBottomPagination.tsx @@ -113,7 +113,7 @@ export const DataListStaticBottomPagination: React.FunctionComponent = () => { return ( - + Projects This is a demo that showcases PatternFly Data List diff --git a/packages/react-core/src/demos/DescriptionList/examples/DescriptionListBasic.tsx b/packages/react-core/src/demos/DescriptionList/examples/DescriptionListBasic.tsx index eb8b8e29bd8..d7ded15e739 100644 --- a/packages/react-core/src/demos/DescriptionList/examples/DescriptionListBasic.tsx +++ b/packages/react-core/src/demos/DescriptionList/examples/DescriptionListBasic.tsx @@ -18,13 +18,13 @@ import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/Dashboard export const DescriptionListBasic: React.FunctionComponent = () => ( - + Projects This is a full page demo - + diff --git a/packages/react-core/src/demos/DescriptionList/examples/DescriptionListInDrawer.tsx b/packages/react-core/src/demos/DescriptionList/examples/DescriptionListInDrawer.tsx index 11986bea3e2..d54bd5e1024 100644 --- a/packages/react-core/src/demos/DescriptionList/examples/DescriptionListInDrawer.tsx +++ b/packages/react-core/src/demos/DescriptionList/examples/DescriptionListInDrawer.tsx @@ -150,13 +150,13 @@ export const DescriptionListInDrawer: React.FunctionComponent = () => { isNotificationDrawerExpanded={isExpanded} onNotificationDrawerExpand={onExpand} > - <PageSection> + <PageSection aria-label="Main Title"> <Content> <Content component="h1">Main title</Content> <Content component="p">This is a full page demo.</Content> </Content> </PageSection> - <PageSection>{drawerContent}</PageSection> + <PageSection aria-label="Drawer Content">{drawerContent}</PageSection> </DashboardWrapper> ); }; diff --git a/packages/react-core/src/demos/JumpLinks.md b/packages/react-core/src/demos/JumpLinks.md index 5213798b16e..dde057252d2 100644 --- a/packages/react-core/src/demos/JumpLinks.md +++ b/packages/react-core/src/demos/JumpLinks.md @@ -79,7 +79,7 @@ ScrollspyH2 = () => { return ( <DashboardWrapper breadcrumb={null} mainContainerId="scrollable-element"> - <PageSection> + <PageSection aria-label = 'Main title'> <Title headingLevel="h1" size="2xl"> Main title @@ -90,10 +90,10 @@ ScrollspyH2 = () => { onChange={(_event, check) => setIsVertical(check)} /> - + - + { - + {headings.map(i => (
diff --git a/packages/react-core/src/demos/Tabs.md b/packages/react-core/src/demos/Tabs.md index 846321906e0..2948a848b37 100644 --- a/packages/react-core/src/demos/Tabs.md +++ b/packages/react-core/src/demos/Tabs.md @@ -159,7 +159,7 @@ TabsOpenDemo = () => { return ( {tabsBreadcrumb} - + { - + Details} tabContentId={`tabContent${0}`} /> YAML} tabContentId={`tabContent${1}`} /> @@ -187,7 +187,7 @@ TabsOpenDemo = () => { Terminal} tabContentId={`tabContent${4}`} /> - + @@ -355,7 +355,7 @@ TabsOpenWithSecondaryTabsDemo = () => { return ( {tabsBreadcrumb} - + { - + Details} tabContentId={`tabContent${0}`} /> YAML} tabContentId={`tabContent${1}`} /> @@ -383,7 +383,7 @@ TabsOpenWithSecondaryTabsDemo = () => { Terminal} tabContentId={`tabContent${4}`} /> - +