Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix issue on pages without module-level stability
  • Loading branch information
silverwind committed Jul 7, 2025
commit 508f94188ff4136ce6bb6837a6bdbc284224a57e
11 changes: 6 additions & 5 deletions doc/api_assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ p {
padding-bottom: 2rem;
}

/* prevent the sticky stability header from overlapping the section header */
#apicontent:has(> .api_stability) a {
Copy link
Member

@dario-piotrowicz dario-piotrowicz Jul 8, 2025

Choose a reason for hiding this comment

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

this means that every single a of every single page that has an api stability banner will receive the scroll-margin-top attribute.... is that correct? cause the comment above suggests to me that this is only specific for headers? 🤔

Copy link
Contributor Author

@silverwind silverwind Jul 8, 2025

Choose a reason for hiding this comment

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

It means every page that has a top-level stability banner. The docs HTML layout is like this:

<div id="apicontent">
  <div class="api-stability"></div>
  <a></a>
  <section>
    <div class="api-stability"></div>
    <a></a>
  </section>
</div>

On some pages like the errors page, the first api-stability is missing, so it won't work on the section stabilities there, for example https://nodejs.org/api/errors.html#err_cpu_usage.

Honestly I think this is not completely solveable from CSS and would prefer if the sticky headers would be removed. This is a best-effort solution that should work in 99% of cases. I hear the docs will be re-written so maybe this is fine as an interim solution.

scroll-margin-top: 50px;
}

table {
border-collapse: collapse;
margin: 0 0 1.5rem;
Expand Down Expand Up @@ -662,10 +667,6 @@ a code {
-webkit-padding-start: 1.5rem;
}

#column1 a {
scroll-margin-top: 50px;
}

#column2.interior {
width: 234px;
background-color: var(--color-fill-side-nav);
Expand Down Expand Up @@ -841,7 +842,7 @@ kbd {
.api_stability {
top: 0;
}
#column1 a {
#apicontent a {
scroll-margin-top: 0;
}
}
Expand Down
Loading