fix(connect-wallet): give each network heading its own anchor id - #662
Open
pucedoteth wants to merge 1 commit into
Open
fix(connect-wallet): give each network heading its own anchor id#662pucedoteth wants to merge 1 commit into
pucedoteth wants to merge 1 commit into
Conversation
`AddNetworkButton` is parameterised by `network`, but its permalink anchor is
hardcoded:
<a href="#mainnet" id="mainnet" className="subheading-anchor" ... />
`general/connect-wallet.mdx` renders the component twice, once per network, so
both headings emit the same id. From the built page:
$ grep -o 'id="mainnet"' .next/server/pages/general/connect-wallet.html | wc -l
2
... Mainnet <a href="#mainnet" id="mainnet" class="subheading-anchor" ...
... Testnet (Sepolia) <a href="#mainnet" id="mainnet" class="subheading-anchor" ...
Three things follow. The document carries a duplicate id, which is invalid
HTML and makes `getElementById` and `:target` resolve to whichever comes
first. The permalink on "Testnet (Sepolia)" navigates to Mainnet, so the
control that exists to link to a section links to the wrong one. And the
testnet section has no anchor at all, so it cannot be linked to.
Derive both from the `network` prop. Mainnet keeps `#mainnet`, so any existing
link still resolves, and the testnet heading gets `#sepolia`.
After the change the built page has one of each, on the right heading:
... Mainnet <a href="#mainnet" id="mainnet" ...
... Testnet (Sepolia) <a href="#sepolia" id="sepolia" ...
`lint:js`, `lint:mdx` and `format:js:check` pass, and `pnpm run build`
succeeds. `spellcheck:lint` fails on main for unrelated reasons, covered in
inkonchain#661.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
pucedoteth
force-pushed
the
fix/add-network-anchor-id
branch
from
August 31, 2026 21:42
f5e7b45 to
bd9c038
Compare
kutluhaneth46
approved these changes
Sep 5, 2026
kutluhaneth46
left a comment
There was a problem hiding this comment.
Review
Good catch on the duplicate anchors.
Both AddNetworkButton instances were hard-coding id="mainnet" / href="#mainnet", so the Sepolia heading collided with Mainnet in the page DOM and broke deep-links / TOC targets. Using `#${network}` matches the existing network prop ("mainnet" | "testnet") and keeps permalinks unique.
LGTM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
AddNetworkButtontakes anetworkprop, but its permalink anchor is hardcoded:general/connect-wallet.mdxrenders the component twice, once per network:So both headings emit the same id. From the built page on
main:Three things follow:
getElementByIdand:targetresolve to whichever element comes first.Fix
Derive both from the
networkprop:Mainnet keeps
#mainnet, so any existing link or bookmark still resolves, and the testnet heading gets#sepolia.Verification
Rebuilt and re-checked the same page:
One of each, on the correct heading.
pnpm run buildsucceeds.lint:js,lint:mdxandformat:js:checkall pass.spellcheck:lintfails onmainfor unrelated reasons (missing dictionary words) which #661 covers; this change adds nothing to it.Note
This is independent of my two other open PRs here (#654, #661) and touches a different file, so they can be merged in any order.