Skip to content

Commit

Permalink
fix: Make "navskip" apply to all headings in an element (#5364)
Browse files Browse the repository at this point in the history
Fixes #5291
  • Loading branch information
larseggert authored Mar 17, 2023
1 parent 57030e4 commit 8dd6947
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
7 changes: 4 additions & 3 deletions ietf/static/js/ietf.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ $(document)
$(function () {
const contentElement = $('#content.ietf-auto-nav');
if (contentElement.length > 0) {
const heading_selector = "h2:not([style='display:none']):not(.navskip), h3:not([style='display:none']):not(.navskip), h4:not([style='display:none']):not(.navskip), h5:not([style='display:none']):not(.navskip), h6:not([style='display:none']):not(.navskip), .nav-heading:not([style='display:none']):not(.navskip)";
const heading_selector = ":is(h2, h3, h4, h5, h6, .nav-heading):not([style='display:none']):not(.navskip)";
const headings = contentElement
.find(heading_selector);
.find(heading_selector)
.filter((i, el) => !el.closest(".navskip"));

const contents = (headings.length > 0) &&
($(headings)
Expand Down Expand Up @@ -195,7 +196,7 @@ $(function () {
.children()
.last();

populate_nav(nav[0], heading_selector);
populate_nav(nav[0], headings.toArray());

if (haveExtraNav) {
$('#righthand-panel').append('<div id="righthand-extra" class="w-100 py-3"></div>');
Expand Down
3 changes: 1 addition & 2 deletions ietf/static/js/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ function get_level(el) {
return h.charAt(h.length - 1);
}

export function populate_nav(nav, heading_selector, classes) {
export function populate_nav(nav, headings, classes) {
// Extract section headings from document
const headings = document.querySelectorAll(heading_selector);
const min_level = Math.min(...Array.from(headings)
.map(get_level));

Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/meeting/important-dates.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ <h2 class="mt-5">
</table>
{% endif %}
{% endfor %}
<div id="cal" class="mt-5"></div>
<div id="cal" class="navskip mt-5"></div>
{% endblock %}
{% block js %}
<script src="{% static "ietf/js/list.js" %}"></script>
Expand Down

0 comments on commit 8dd6947

Please sign in to comment.