Skip to content

deepLinking setting not working as expected - does not scroll down properly #5480

Open
@phillipmovista

Description

@phillipmovista

Q&A (please complete the following information)

  • OS: macOS
  • Browser: Chrome
  • Version: 75.0.3770.100
  • Method of installation: direct js files
  • Swagger-UI version: Newest, I believe
  • Swagger/OpenAPI version: OpenAPI 3

Content & configuration

I have inherited a project from someone else setting up swagger-ui standalone in our website, importing a list of URLs from a JSON file and trying to use deepLinking to jump straight to operations in the page so I can link around from page to page.

Swagger-UI configuration options:
I load up the urlsListFile to grab the data and then drop it into the urls as an array (I would be totally happy with a different way of doing this, but I need to pick the urlsListFile based on version selected in another part of the site)

  jQuery.getJSON(urlsListFile, function( data ) {
    const ui = SwaggerUIBundle({
      urls: data.urls,
      dom_id: '#swagger-ui',
      deepLinking: true,
      presets: [
        SwaggerUIBundle.presets.apis,
        SwaggerUIStandalonePreset
      ],
      plugins: [
        SwaggerUIBundle.plugins.DownloadUrl
      ],
      supportedSubmitMethods: [],
      layout: "StandaloneLayout"
    });
    
    window.ui = ui;
  })

I got this URL by clicking on the Location section of the Locations API page and it created this for me. I copied and put it in another section of my site.

?urls.primaryName=Locations#/Location

Describe the bug you're encountering

When the page loads up for Locations API, it just stays at the top of the page and does not scroll down to #/Location like I would expect it to.

To reproduce...

This is on a local development environment so I cannot share a link right now, but any suggestions of things to try, parameters to add, etc - would be appreciated.

If someone knows how also, when I do the markup for a link on one of my other pages, it always adds target=_blank which I do not want because I am linking around the same site, how can I get rid of that?

Is it possible that having the urls.primaryName in my URL is causing a problem? All the working examples do not have that.

Expected behavior

When the link is visited to jump from one page directly to the GET call for Location/getLocation - I expect the page to scroll down, just like the example in #4817 (comment) where it goes to /pet/addPet as a direct jump.

Additional context or thoughts

Thanks so much for the help. I have spent a lot of time getting the documentation together for this project and look forward to wrapping up the linking, etc.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions