Fix: allow custom media-item--heading tag #1976
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 fromh1
(the page title) toh3
(the first media item).In
eligibility:start
(the other place where media items are used), there is an interveningh2
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
Enrollment index --
h2
is skippedAfter
Eligibility start -- correct heading levels
Enrollment index --
.media-item--heading
is overridden toh2
, styling remains the same