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

Adding ScrollTo support for Models #5237

Merged

Conversation

geraldglynn
Copy link
Contributor

Description

Added onLoad functions and tweaked an onToggle function in the following files:
src/core/components/models.jsx
src/core/components/model-collapse.jsx
src/core/components/model-wrapper.jsx

Motivation and Context

We would like ScrollTo to work for Models for when the SpecPath is in the URL Fragment (hash)

How Has This Been Tested?

This has been tested by overriding the component using the plugin architecture in our system.

Manual tests by our QA team

Screenshots (if appropriate):

Checklist

My PR contains...

  • No code changes (src/ is unmodified: changes to documentation, CI, metadata, etc.)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fixes (non-breaking change which fixes an issue)
  • Improvements (misc. changes to existing features)
  • Features (non-breaking change which adds functionality)

My changes...

  • are breaking changes to a public API (config options, System API, major UI change, etc).
  • are breaking changes to a private API (Redux, component props, utility functions, etc.).
  • are breaking changes to a developer API (npm script behavior changes, new dev system dependencies, etc).
  • are not breaking changes.

Documentation

  • My changes do not require a change to the project documentation.
  • My changes require a change to the project documentation.
  • If yes to above: I have updated the documentation accordingly.

Automated tests

  • My changes can not or do not need to be tested.
  • My changes can and should be tested by unit and/or integration tests.
  • If yes to above: I have added tests to cover my changes.
  • If yes to above: I have taken care to cover edge cases in my tests.
  • All new and existing tests passed.

^ I'm not 100% sure about Documentation & Tests, please let me know otherwise

@mdhtr mdhtr mentioned this pull request May 9, 2020
17 tasks
@tim-lai tim-lai merged commit 59bbe4f into swagger-api:master Jun 15, 2020
@mdhtr
Copy link

mdhtr commented Jun 15, 2020

@geraldglynn @tim-lai

I might have had the wrong assumption about what this feature does (so also referencing it as the earlier version of my PR could have been wrong).

How do I make this feature work in the UI?

I wanted to try out if it is doing what I would expect it to do but couldn't make it work. Clicking a model name does not put the fragment in the URL and I couldn't come up with an URL fragment that would scroll to the specific model. I tried #/models/Category, #model/Category and #/model-Category (which is the id in the HTML) but neither of them resulted in scrolling to the Category model in the petstore.

mattyb678 pushed a commit to mattyb678/swagger-ui that referenced this pull request Jun 24, 2020
@zorbash
Copy link

zorbash commented Feb 10, 2023

@geraldglynn [documentation request] Can you please provide an example of how this feature can be used?

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.

4 participants