Skip to content

Conversation

jonkafton
Copy link
Contributor

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/8556

Description (What does it do?)

Updates the learning resource drawer title to use <h2> and section (carousel) headings to use <h3>.

Screenshots (if appropriate):

image image

How can this be tested?

Open a resource drawer and confirm that the headings are indeed using heading elements and that there is no impact to styles or layout.

@jonkafton jonkafton assigned jonkafton and unassigned jonkafton Oct 8, 2025
@jonkafton jonkafton added the Needs Review An open Pull Request that is ready for review label Oct 8, 2025
Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Small suggestion to help us avoid doing this again. Didn't cause any type errors.

diff --git a/frontends/main/src/page-components/ResourceCarousel/ResourceCarousel.tsx b/frontends/main/src/page-components/ResourceCarousel/ResourceCarousel.tsx
index a7ea37a1f..f5a897cdd 100644
--- a/frontends/main/src/page-components/ResourceCarousel/ResourceCarousel.tsx
+++ b/frontends/main/src/page-components/ResourceCarousel/ResourceCarousel.tsx
@@ -175,8 +175,11 @@ type ResourceCarouselProps = {
   "data-testid"?: string
   /**
    * Element type for the carousel title
+   *
+   * Note: This could allow wider elements, but we want to restrict it to
+   * headings for semantic purposes.
    */
-  titleComponent?: React.ElementType
+  titleComponent?: "h2" | "h3" | "h4" | "h5" | "h6"
   titleVariant?: TypographyProps["variant"]
   excludeResourceId?: number
 }
@@ -225,7 +228,7 @@ const ResourceCarousel: React.FC<ResourceCarouselProps> = ({
   title,
   className,
   isLoading,
-  titleComponent = "h4",
+  titleComponent,
   titleVariant = "h4",
   excludeResourceId,
 }) => {

return (
<ResourceCarousel
titleComponent="p"
titleComponent="h3"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small suggestion to help us avoid doing this again. Didn't cause any type errors.

diff --git a/frontends/main/src/page-components/ResourceCarousel/ResourceCarousel.tsx b/frontends/main/src/page-components/ResourceCarousel/ResourceCarousel.tsx
index a7ea37a1f..f5a897cdd 100644
--- a/frontends/main/src/page-components/ResourceCarousel/ResourceCarousel.tsx
+++ b/frontends/main/src/page-components/ResourceCarousel/ResourceCarousel.tsx
@@ -175,8 +175,11 @@ type ResourceCarouselProps = {
   "data-testid"?: string
   /**
    * Element type for the carousel title
+   *
+   * Note: This could allow wider elements, but we want to restrict it to
+   * headings for semantic purposes.
    */
-  titleComponent?: React.ElementType
+  titleComponent?: "h2" | "h3" | "h4" | "h5" | "h6"
   titleVariant?: TypographyProps["variant"]
   excludeResourceId?: number
 }
@@ -225,7 +228,7 @@ const ResourceCarousel: React.FC<ResourceCarouselProps> = ({
   title,
   className,
   isLoading,
-  titleComponent = "h4",
+  titleComponent,
   titleVariant = "h4",
   excludeResourceId,
 }) => {

@jonkafton jonkafton merged commit e73eedf into main Oct 9, 2025
13 checks passed
@jonkafton jonkafton deleted the jk/8556-header-elements branch October 9, 2025 17:58
@odlbot odlbot mentioned this pull request Oct 16, 2025
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review An open Pull Request that is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants