Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
httpJunkie opened this issue Dec 13, 2022 · 2 comments
Open

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

httpJunkie opened this issue Dec 13, 2022 · 2 comments

Comments

@httpJunkie
Copy link

httpJunkie commented Dec 13, 2022

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

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

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.

@shanejonas
Copy link
Contributor

this already exists and lives in the api-playground repo:

Could be a bug with the implementation

https://github.com/MetaMask/api-playground/blob/main/src/pages/api-documentation.tsx#L118-L129

@shanejonas
Copy link
Contributor

going to move this to api-playground repo

@shanejonas shanejonas transferred this issue from MetaMask/api-specs Jan 24, 2023
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

No branches or pull requests

2 participants