Skip to content

[@W-21514384] fix(api-summary): resolve gRPC navigation when clicking nested span badges #59

Merged
alexpmule merged 2 commits intomasterfrom
fix/grpc-navigation-links
Mar 10, 2026
Merged

[@W-21514384] fix(api-summary): resolve gRPC navigation when clicking nested span badges #59
alexpmule merged 2 commits intomasterfrom
fix/grpc-navigation-links

Conversation

@alexpmule
Copy link
Copy Markdown
Contributor

@alexpmule alexpmule commented Mar 10, 2026

Summary

Fixes gRPC method badge clicks not triggering navigation in the API summary TOC.

  • Root cause: _navigateItem was reading e.composedPath()[0] (the deepest element clicked). For gRPC methods, the <a> contains a child <span class="grpc-stream-type">, so clicking the badge returned the span — which has no data-id — and the handler silently exited.
  • Fix: Walk composedPath() until finding the first element with both data-id and data-shape-type, instead of assuming the first element always has them.
  • REST method navigation is unaffected (anchor is still the first element with dataset for REST).

Changes

  • src/ApiSummary.js_navigateItem: walk composedPath to find data-bearing ancestor
  • test/api-summary.test.js — 2 new regression tests in the gRPC suite:
    • Click on .grpc-stream-type span → event fires with correct id and type: "method"
    • Click directly on .method-label.grpc-container anchor → still works
  • package.json — version bump 4.6.18 → 4.6.19

Test plan

  • npm test passes (125 tests, 0 failures, 95.62% coverage)
  • New test: clicking gRPC span badge fires api-navigation-selection-changed
  • New test: clicking gRPC anchor directly still fires the event
  • Manual: load a gRPC API in the demo, click Unary/Bidirectional badges → navigates to method docs
  • Manual: REST method badges still navigate correctly

Test in API Console

Screen.Recording.2026-03-10.at.2.45.29.PM.mov

GUS

W-21514384

Walk composedPath() to find the first ancestor with data-id and
data-shape-type, so clicking a child <span class="grpc-stream-type">
inside the <a> correctly fires api-navigation-selection-changed.

Adds two regression tests: one for the span click path and one for
the direct anchor click. Bumps version to 4.6.19.

Made-with: Cursor
@alexpmule alexpmule merged commit 3fab3e3 into master Mar 10, 2026
4 checks passed
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