Skip to content

Commit

Permalink
Ensure heading components use semantic elements (#1014)
Browse files Browse the repository at this point in the history
* Restrict headline components' as prop to heading elements

* Add changeset
  • Loading branch information
connor-baer authored Jul 2, 2021
1 parent e76f2d0 commit 2e0e438
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-buckets-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sumup/circuit-ui': major
---

Restricted the `Headline`'s and `SubHeadline`'s `as` prop to heading elements.
2 changes: 1 addition & 1 deletion packages/circuit-ui/components/Headline/Headline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface HeadlineProps
* without skipping any levels. Learn more at
* https://www.w3.org/WAI/tutorials/page-structure/headings/.
*/
as: string;
as: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
}

const baseStyles = ({ theme }: StyleProps) => css`
Expand Down
2 changes: 1 addition & 1 deletion packages/circuit-ui/components/SubHeadline/SubHeadline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface SubHeadlineProps
* without skipping any levels. Learn more at
* https://www.w3.org/WAI/tutorials/page-structure/headings/.
*/
as: string;
as: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
}

const baseStyles = ({ theme }: StyleProps) => css`
Expand Down

0 comments on commit 2e0e438

Please sign in to comment.