Skip to content

Commit

Permalink
Fixed: Ensure Header component uses proper semantic header HTML tag (#…
Browse files Browse the repository at this point in the history
…3533)

* Fixed: Ensure Header component uses proper semantic header HTML tag

* Fix: Ensure Header component uses proper semantic header HTML tag

* Test: Snapshots for Header component

* Change div to header for test case

---------

Co-authored-by: Josh Black <joshblack@github.com>
  • Loading branch information
amarmanhala and joshblack authored Jul 20, 2023
1 parent 311c8c9 commit 33b6055
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .changeset/new-timers-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@primer/react': patch
---

Changed div tag to HTML semantic tag header for Header (file Header.tsx) component.

<!-- Changed components: _none_ -->
2 changes: 1 addition & 1 deletion src/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type StyledHeaderItemProps = {full?: boolean} & SxProp
type StyledHeaderProps = SxProp
type StyledHeaderLinkProps = {to?: Location | Pathname} & SxProp

const Header = styled.div<StyledHeaderProps>`
const Header = styled.header<StyledHeaderProps>`
z-index: 32;
display: flex;
padding: ${get('space.3')};
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/Header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('Header', () => {
})

it('renders a <div> and <a>', () => {
expect(render(<Header />).type).toEqual('div')
expect(render(<Header />).type).toEqual('header')
expect(render(<Header.Link />).type).toEqual('a')
})

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/__snapshots__/Header.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ exports[`Header renders consistently 1`] = `
flex-wrap: nowrap;
}
<div
<header
className="c0"
/>
`;

0 comments on commit 33b6055

Please sign in to comment.