Skip to content

Commit 08cdb0b

Browse files
authored
Fix title and subtitle tag for Dialog2 and ConfirmationDialog (#1754)
* use h1 + h2 for Dialogs * add changeset
1 parent 2b3744e commit 08cdb0b

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

.changeset/dialogs-title-tag.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': patch
3+
---
4+
5+
Fix title and subtitle tag for Dialog2 and ConfirmationDialog

src/Dialog/ConfirmationDialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ const StyledConfirmationHeader = styled.header`
4545
display: flex;
4646
flex-direction: row;
4747
`
48-
const StyledTitle = styled(Box)`
48+
const StyledTitle = styled(Box).attrs({as: 'h1'})`
4949
font-size: ${get('fontSizes.3')};
5050
font-weight: ${get('fontWeights.bold')};
5151
padding: 6px ${get('space.2')};
5252
flex-grow: 1;
53+
margin: 0; /* override default margin */
5354
`
5455
const ConfirmationHeader: React.FC<DialogHeaderProps> = ({title, onClose, dialogLabelId}) => {
5556
const onCloseClick = useCallback(() => {

src/Dialog/Dialog.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,18 @@ const Header = styled.div.attrs<SxProp>({as: 'header'})`
314314
flex-shrink: 0;
315315
`
316316

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

324-
const Subtitle = styled.div<SxProp>`
324+
const Subtitle = styled.h2<SxProp>`
325325
font-size: ${get('fontSizes.0')};
326-
margin-top: ${get('space.1')};
327326
color: ${get('colors.fg.muted')};
327+
margin: 0; /* override default margin */
328+
margin-top: ${get('space.1')};
328329
329330
${sx};
330331
`

0 commit comments

Comments
 (0)