From fed1c57b20d5c344a03d5fdeb5c5552c19eabea1 Mon Sep 17 00:00:00 2001 From: Jeremy Neal Date: Mon, 8 May 2023 17:41:13 -0400 Subject: [PATCH] PageLayout.Content should not use main landmark by default. (#3154) * PageLayout.Content should not use main landmark by default. * Create eleven-humans-sneeze.md * Revert unrelated snapshots. * Use explicit main tag in PageLayout test instead of passing as prop. * Update generated/components.json * PageLayout.Content should not have as prop. * Update generated/components.json * Update .changeset/eleven-humans-sneeze.md Co-authored-by: Tyler Jones * Don't add role to PageLayout.Content. --------- Co-authored-by: radglob Co-authored-by: Tyler Jones --- .changeset/eleven-humans-sneeze.md | 5 +++++ src/PageLayout/PageLayout.test.tsx | 6 ++++-- src/PageLayout/PageLayout.tsx | 1 - .../__snapshots__/PageLayout.test.tsx.snap | 16 ++++++++-------- .../__snapshots__/SplitPageLayout.test.tsx.snap | 4 ++-- 5 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 .changeset/eleven-humans-sneeze.md diff --git a/.changeset/eleven-humans-sneeze.md b/.changeset/eleven-humans-sneeze.md new file mode 100644 index 00000000000..e881e43ce14 --- /dev/null +++ b/.changeset/eleven-humans-sneeze.md @@ -0,0 +1,5 @@ +--- +"@primer/react": patch +--- + +PageLayout.Content no longer renders as `main` by default. Instead, developers may add a `main` landmark within `Pagelayout.Content` themselves. diff --git a/src/PageLayout/PageLayout.test.tsx b/src/PageLayout/PageLayout.test.tsx index 1ab69e8a5c1..57552103db2 100644 --- a/src/PageLayout/PageLayout.test.tsx +++ b/src/PageLayout/PageLayout.test.tsx @@ -123,7 +123,9 @@ describe('PageLayout', () => { Header - Content + +
Content
+
Pane Footer
@@ -154,7 +156,7 @@ describe('PageLayout', () => { ) expect(screen.getByRole('banner')).toHaveAccessibleName('header') - expect(screen.getByRole('main')).toHaveAccessibleName('content') + expect(screen.getByLabelText('content')).toBeInTheDocument() expect(screen.getByRole('contentinfo')).toHaveAccessibleName('footer') }) diff --git a/src/PageLayout/PageLayout.tsx b/src/PageLayout/PageLayout.tsx index cda091d97fc..b4c89fd7916 100644 --- a/src/PageLayout/PageLayout.tsx +++ b/src/PageLayout/PageLayout.tsx @@ -421,7 +421,6 @@ const Content: React.FC> = ({ return ( ( diff --git a/src/PageLayout/__snapshots__/PageLayout.test.tsx.snap b/src/PageLayout/__snapshots__/PageLayout.test.tsx.snap index 97b5bfbea64..30144461b0c 100644 --- a/src/PageLayout/__snapshots__/PageLayout.test.tsx.snap +++ b/src/PageLayout/__snapshots__/PageLayout.test.tsx.snap @@ -199,7 +199,7 @@ exports[`PageLayout renders condensed layout 1`] = `
-
-
+
@@ -493,7 +493,7 @@ exports[`PageLayout renders default layout 1`] = `
-
-
+
@@ -787,7 +787,7 @@ exports[`PageLayout renders pane in different position when narrow 1`] = `
-
-
+
@@ -1081,7 +1081,7 @@ exports[`PageLayout renders with dividers 1`] = `
-
-
+
diff --git a/src/SplitPageLayout/__snapshots__/SplitPageLayout.test.tsx.snap b/src/SplitPageLayout/__snapshots__/SplitPageLayout.test.tsx.snap index c35d5dc97cd..1486e3792bb 100644 --- a/src/SplitPageLayout/__snapshots__/SplitPageLayout.test.tsx.snap +++ b/src/SplitPageLayout/__snapshots__/SplitPageLayout.test.tsx.snap @@ -234,7 +234,7 @@ exports[`SplitPageLayout renders default layout 1`] = `
-
-
+