-
Notifications
You must be signed in to change notification settings - Fork 306
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 glossary header bug #7371
Fix glossary header bug #7371
Conversation
- [x] tested when glossary is not enabled - [x] tested when glossary is enabled with summary box - [x] updated glossary.html to set header class for tagetting to hide in summary-box.js - [x] set conditional to hide/display glossary.html partial based on glossary field set in parent _index.md
{{- if .Parent.Params.glossary -}} | ||
{{- partial "core/glossary.html" . -}} | ||
{{- end -}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if .Parent
page has glossary
field set. This refers to the root _index.md
in the guide directory.
@@ -13,7 +13,7 @@ | |||
</svg> | |||
</button> | |||
|
|||
<h2>Glossary</h2> | |||
<h2 class="dg-glossary__header">Glossary</h2> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added class as a hook for the javascript.
@@ -10,7 +10,7 @@ | |||
|
|||
const guideSummaryList = guideSummary.querySelector(".usa-list"); | |||
const pageHeaders = document.querySelectorAll( | |||
"h2:not(.usa-summary-box__heading, .dg-guide__content-header-title)" | |||
"h2:not(.usa-summary-box__heading, .dg-guide__content-header-title, .dg-glossary__header)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This query acts as "blacklist" of headers to not in the summary box
component depending on the page it is called from.
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well, nice job. Minor comments on adding documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Added suggestions for clarity & code comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, removed duplicate header in c993905.
Summary
Guide pages that display a
summary-box
component also display the Glossaryh2
when it should not be visible.glossary.html
is unnecessarily rendered on guide pages that don't use a glossary.See guides/dap/common-questions-about-dap
Preview
Link to Preview
Solution
glossary.html
when.Parent.Params.glossary
is true.summary-box
component is used on a page with aglossary
component enabled, then don't display the Glossaryh2
.h2
insummary-box.js
How To Test
summary box
when glossary is not enabled.summary box
when glossary is enabled.summary_box: true
oncontent/guides/hcd/discovery-concepts/present.md
on your local machinesummary box
when glossary is enabled.summary_box: true
oncontent/guides/hcd/introduction/_index.md
on your local machineWhat To Test
glossary.html
is not rendered whenglossary
field is not setdg-glossary__container
is not present in markupsummary-box
component does not display Glossaryh2
at all (even when set).Dev Checklist