Skip to content

Commit

Permalink
PageLayout.Content should not use main landmark by default. (#3154)
Browse files Browse the repository at this point in the history
* 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 <tylerjdev@github.com>

* Don't add role to PageLayout.Content.

---------

Co-authored-by: radglob <radglob@users.noreply.github.com>
Co-authored-by: Tyler Jones <tylerjdev@github.com>
  • Loading branch information
3 people authored May 8, 2023
1 parent 7f2ddce commit fed1c57
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/eleven-humans-sneeze.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 4 additions & 2 deletions src/PageLayout/PageLayout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ describe('PageLayout', () => {
<ThemeProvider>
<PageLayout>
<PageLayout.Header aria-label="header">Header</PageLayout.Header>
<PageLayout.Content aria-label="content">Content</PageLayout.Content>
<PageLayout.Content>
<main aria-label="content">Content</main>
</PageLayout.Content>
<PageLayout.Pane>Pane</PageLayout.Pane>
<PageLayout.Footer aria-label="footer">Footer</PageLayout.Footer>
</PageLayout>
Expand Down Expand Up @@ -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')
})

Expand Down
1 change: 0 additions & 1 deletion src/PageLayout/PageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ const Content: React.FC<React.PropsWithChildren<PageLayoutContentProps>> = ({

return (
<Box
as="main"
aria-label={label}
aria-labelledby={labelledBy}
sx={merge<BetterSystemStyleObject>(
Expand Down
16 changes: 8 additions & 8 deletions src/PageLayout/__snapshots__/PageLayout.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ exports[`PageLayout renders condensed layout 1`] = `
<div
class="c5"
>
<main
<div
class="c6"
>
<div
Expand All @@ -213,7 +213,7 @@ exports[`PageLayout renders condensed layout 1`] = `
<div
class=""
/>
</main>
</div>
<div
class="c8"
>
Expand Down Expand Up @@ -493,7 +493,7 @@ exports[`PageLayout renders default layout 1`] = `
<div
class="c5"
>
<main
<div
class="c6"
>
<div
Expand All @@ -507,7 +507,7 @@ exports[`PageLayout renders default layout 1`] = `
<div
class=""
/>
</main>
</div>
<div
class="c8"
>
Expand Down Expand Up @@ -787,7 +787,7 @@ exports[`PageLayout renders pane in different position when narrow 1`] = `
<div
class="c5"
>
<main
<div
class="c6"
>
<div
Expand All @@ -801,7 +801,7 @@ exports[`PageLayout renders pane in different position when narrow 1`] = `
<div
class=""
/>
</main>
</div>
<div
class="c8"
>
Expand Down Expand Up @@ -1081,7 +1081,7 @@ exports[`PageLayout renders with dividers 1`] = `
<div
class="c5"
>
<main
<div
class="c6"
>
<div
Expand All @@ -1095,7 +1095,7 @@ exports[`PageLayout renders with dividers 1`] = `
<div
class=""
/>
</main>
</div>
<div
class="c8"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ exports[`SplitPageLayout renders default layout 1`] = `
<div
class="c5"
>
<main
<div
class="c6"
>
<div
Expand All @@ -248,7 +248,7 @@ exports[`SplitPageLayout renders default layout 1`] = `
<div
class=""
/>
</main>
</div>
<div
class="c8"
>
Expand Down

0 comments on commit fed1c57

Please sign in to comment.