Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: allow custom media-item--heading tag #1976

Merged
merged 1 commit into from
Mar 22, 2024
Merged

Conversation

thekaveman
Copy link
Member

Fixes #1975

Previously h3 was hard-coded as the heading tag for media items.

This caused a bug in enrollment:index, where heading levels skip from h1 (the page title) to h3 (the first media item).

In eligibility:start (the other place where media items are used), there is an intervening h2 that keeps the order correct.

This change allows a child media item to override the heading tag, while maintaining the h3 styling for all .media-item--heading, regardless of tag used.

The default tag remains h3 if a child media item does not choose to override.

Found this answer on SO which showed that, with an extra wrapping {% block %}, context from the child can be passed up to the parent using {% with %}: https://stackoverflow.com/a/46581444 TIL!

Before

Eligibility start -- correct heading levels

image

Enrollment index -- h2 is skipped

image

After

Eligibility start -- correct heading levels

image

Enrollment index -- .media-item--heading is overridden to h2, styling remains the same

image

previously h3 was hardcoded as the heading tag for media items

this caused a bug in enrollment index, where heading levels skip
from h1 (the page title) to h3 (the first media item)

in eligibility start, there is an intervening h2 that keeps the order correct

this change allows a child media item to override the heading tag, while maintaining
the h3 styling for all media-item--heading, regardless of tag used

the default tag remains h3 if a child media item does not choose to override
@thekaveman thekaveman self-assigned this Mar 22, 2024
@thekaveman thekaveman requested a review from a team as a code owner March 22, 2024 18:55
@github-actions github-actions bot added deployment-dev [auto] Changes that will trigger a deploy if merged to dev front-end HTML/CSS/JavaScript and Django templates labels Mar 22, 2024
@thekaveman thekaveman added the bug Something isn't working label Mar 22, 2024
Copy link

Coverage report

This PR does not seem to contain any modification to coverable code.

@thekaveman thekaveman mentioned this pull request Mar 22, 2024
5 tasks
Copy link
Member

@angela-tran angela-tran left a comment

Choose a reason for hiding this comment

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

Nice!! 🔥

@thekaveman thekaveman merged commit 4a450a4 into dev Mar 22, 2024
11 checks passed
@thekaveman thekaveman deleted the fix/media-item-heading branch March 22, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working deployment-dev [auto] Changes that will trigger a deploy if merged to dev front-end HTML/CSS/JavaScript and Django templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enrollment index skips H2 heading level
2 participants