Skip to content

fix(web): shorten method labels in sidebar#798

Merged
avivkeller merged 1 commit into
nodejs:mainfrom
panva:fix/sidebar-compact-signatures
Jun 26, 2026
Merged

fix(web): shorten method labels in sidebar#798
avivkeller merged 1 commit into
nodejs:mainfrom
panva:fix/sidebar-compact-signatures

Conversation

@panva

@panva panva commented May 17, 2026

Copy link
Copy Markdown
Member

The TOCs are barely usable when methods include their possibly many parameters.

before after
sidebar-before-webcrypto-toc sidebar-after-webcrypto-toc

@panva panva requested a review from a team as a code owner May 17, 2026 16:58
@cursor

cursor Bot commented May 17, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Changes only doc-site ToC metadata and labels; page content and anchors for the primary overload heading are unchanged.

Overview
Improves sidebar / table of contents readability for API docs where each overload used to appear as a long signature string.

Before layout is built, annotateOverloads marks consecutive duplicate callable headings (method, ctor, classMethod with the same name, type, and depth) so only the first keeps a ToC slot; later overloads still render on the page. extractHeadings skips entries with isOverload and links to the first signature’s slug.

ToC labels for callables now use headingLabel: bare names from getFullName (e.g. fs.read instead of the full parameter list), with constructors shown as new Buffer. Non-callable headings keep the previous CLI-flag / prefix-stripping behavior. HeadingData.isOverload is added to the metadata types, with unit tests for labeling and overload grouping.

Reviewed by Cursor Bugbot for commit 217358a. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented May 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Jun 26, 2026 6:18pm

Request Review

@codecov

codecov Bot commented May 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.79032% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.99%. Comparing base (14a7014) to head (217358a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/generators/jsx-ast/utils/buildBarProps.mjs 93.47% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #798      +/-   ##
==========================================
+ Coverage   84.79%   84.99%   +0.20%     
==========================================
  Files         177      179       +2     
  Lines       16174    16404     +230     
  Branches     1459     1482      +23     
==========================================
+ Hits        13715    13943     +228     
- Misses       2449     2451       +2     
  Partials       10       10              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@avivkeller avivkeller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These are intentionally expanded, since the short version credits scenarios were multiple headings have the same navigation entry.

The correct approach to shortening these would be to revert the change that expanded them, and consolidate duplicate ToC entries into one.

@panva

panva commented May 17, 2026

Copy link
Copy Markdown
Member Author

These are intentionally expanded

Bold.

There are only ~26-29 collisions in all our docs. I've updated it to keep the compact form when it is unique otherwise keep the full one.

Screenshot 2026-05-17 at 20 39 39

@avivkeller

Copy link
Copy Markdown
Member

cc @nodejs/web-infra I believe the intentional expansion is the method of choice, as it doesn't risk losing any important information, wdyt?

@panva

panva commented Jun 7, 2026

Copy link
Copy Markdown
Member Author

Ping. The current proposal keeps the unique entries short and only expands when there would be conflicts. There should be no question about the improvement to legibility, clarity, and usability.

@avivkeller avivkeller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

give me a moment to make a change

@avivkeller avivkeller force-pushed the fix/sidebar-compact-signatures branch from 2e28a03 to 217358a Compare June 26, 2026 18:17

@avivkeller avivkeller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

give me a moment to make a sense

@avivkeller avivkeller enabled auto-merge (squash) June 26, 2026 18:17
@avivkeller avivkeller merged commit 8851110 into nodejs:main Jun 26, 2026
22 checks passed
@panva panva deleted the fix/sidebar-compact-signatures branch June 26, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants