Skip to content

Commit

Permalink
Fix title and subtitle tag for Dialog2 and ConfirmationDialog (#1754)
Browse files Browse the repository at this point in the history
* use h1 + h2 for Dialogs

* add changeset
  • Loading branch information
siddharthkp committed Dec 21, 2021
1 parent 2b3744e commit 08cdb0b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/dialogs-title-tag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Fix title and subtitle tag for Dialog2 and ConfirmationDialog
3 changes: 2 additions & 1 deletion src/Dialog/ConfirmationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ const StyledConfirmationHeader = styled.header`
display: flex;
flex-direction: row;
`
const StyledTitle = styled(Box)`
const StyledTitle = styled(Box).attrs({as: 'h1'})`
font-size: ${get('fontSizes.3')};
font-weight: ${get('fontWeights.bold')};
padding: 6px ${get('space.2')};
flex-grow: 1;
margin: 0; /* override default margin */
`
const ConfirmationHeader: React.FC<DialogHeaderProps> = ({title, onClose, dialogLabelId}) => {
const onCloseClick = useCallback(() => {
Expand Down
9 changes: 5 additions & 4 deletions src/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,17 +314,18 @@ const Header = styled.div.attrs<SxProp>({as: 'header'})`
flex-shrink: 0;
`

const Title = styled.div<SxProp>`
const Title = styled.h1<SxProp>`
font-size: ${get('fontSizes.1')};
font-weight: ${get('fontWeights.bold')};
margin: 0; /* override default margin */
${sx};
`

const Subtitle = styled.div<SxProp>`
const Subtitle = styled.h2<SxProp>`
font-size: ${get('fontSizes.0')};
margin-top: ${get('space.1')};
color: ${get('colors.fg.muted')};
margin: 0; /* override default margin */
margin-top: ${get('space.1')};
${sx};
`
Expand Down

0 comments on commit 08cdb0b

Please sign in to comment.