Skip to content

Commit

Permalink
Merge pull request #68 from eecs485staff/fix/last-section-active
Browse files Browse the repository at this point in the history
Patch fix bugs from field-testing
  • Loading branch information
seshrs authored Aug 20, 2020
2 parents f40193b + 957559c commit efbd467
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.0
1.3.1.d
10 changes: 10 additions & 0 deletions _sass/spec/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,13 @@ body,
#primer-spec-plugin-main-content {
display: none;
}

// Task List styling *should* have been included in Primer CSS, but it looks
// like they missed to include the styles! Here's a fix for Primer Spec pages,
// we can remove this fix after Primer CSS has been updated.
li.task-list-item {
list-style-type: none;
}
li.task-list-item .task-list-item-checkbox {
margin: 0 0.2em 0.25em -1.6em;
}
2 changes: 1 addition & 1 deletion assets/v1.3/js/primer_spec_plugin.min.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src_js/components/sidebar/TableOfContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ function generateTocNodesForContentNode(
const headings = [
...contentNode.querySelectorAll('h1, h2, h3, h4, h5, h6'),
].filter((heading) => !heading.classList.contains('primer-spec-toc-ignore'));
let activeHeadingIndex = -1;

// Initialize activeHeadingIndex to the last index. If there are no active
// headings below the threshold, we should be highlighting this section.
let activeHeadingIndex = headings.length - 1;
for (let i = 0; i < headings.length; ++i) {
const heading = headings[i];
if (heading.getBoundingClientRect().top - threshold > 0) {
Expand Down

0 comments on commit efbd467

Please sign in to comment.