MetaMask / MetaMask/api-playground

Link to MetaMask API Method expands but doesn't scroll to

Open
#73 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
7
Forks
8
PR merge metrics
No merged PRs in 30d

Description

When navigating to the MetaMask API Playground using an anchor link of one of the API methods does expand the section, but does not scroll to that section. Therefore when trying to link from (for instance) documentation or blog articles, if the method is beyond the fold (bottom of the screen) the user may feel that they have not navigated correctly and will have to scroll on their own.

A good example of this is a method we like to link to a lot from various places:
[eth_chainId](https://metamask.github.io/api-playground/api-documentation/#eth_chainId)

The purpose of this issue is to add the functionality needed, which could be something like:

```javascript
if (window.location.hash) {
// Extract the anchor point from the URL
const anchor = window.location.hash.substr(1);

// Scroll to the anchor point on the page
window.scrollTo({
top: document.getElementById(anchor).offsetTop,
behavior: 'smooth'
});
}
```
Something like that.

Contributor guide

No contributing guide indexed for this repository

Research direction

Open the API Playground link for eth_chainId and inspect the API documentation entry and its anchor-link handling. Trace how the URL hash expands a method, then verify that navigation also scrolls the expanded section into view. Done means links such as #eth_chainId both expand the method and bring it visibly into the viewport.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.