navigate to complete url instead of only fragment/hash#292
Merged
wparad merged 1 commit intoAuthress-Engineering:release/2.4from Dec 17, 2025
Merged
navigate to complete url instead of only fragment/hash#292wparad merged 1 commit intoAuthress-Engineering:release/2.4from
wparad merged 1 commit intoAuthress-Engineering:release/2.4from
Conversation
Using only fragment works completely fine unless base tag is added in head (which makes also pushState urls be relative to it instead of to the current url). Fix by constructing complete url relative to current location.
Member
|
Can you provide a working reproduction of this problem? |
Contributor
Author
|
Following would be a minimal reproduction, the fragment will be prefixed with <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>OpenAPI Explorer Development Test</title>
<script src="https://unpkg.com/openapi-explorer/dist/browser/openapi-explorer.min.js" type="module" defer></script>
<base href="/not/the/path/you/expected/here" />
</head>
<body>
<openapi-explorer spec-url="https://api.authress.io/v1"></openapi-explorer>
</body>
</html> |
Member
|
to complete the reproduction can please include these necessary additional pieces:
As soon as we get those, we can verify this fix solves the problem. Thanks! |
Contributor
Author
Having the openapi-explorer rendered at a path on a page with base tag in head with href attribute (by default set to
Reloading the page stays on the openapi explorer page and at the same location inside
The path from href of base tag is loaded with fragment set by openapi-explorer |
Member
|
Cool, we support this change. |
This was referenced Dec 17, 2025
toy
added a commit
to opf/openproject
that referenced
this pull request
Dec 18, 2025
openapi-explorer uses pushState with anchor only, but this doesn't work with base tag, as anchor is added to the base url instead of current url. So override the replaceState function to construct the full url based on current location Probably not needed very soon, as Authress-Engineering/openapi-explorer#292 was quickly merged
toy
added a commit
to opf/openproject
that referenced
this pull request
Dec 18, 2025
3 tasks
toy
added a commit
to opf/openproject
that referenced
this pull request
Dec 18, 2025
toy
added a commit
to opf/openproject
that referenced
this pull request
Dec 18, 2025
openapi-explorer uses pushState with anchor only, but this doesn't work with base tag, as anchor is added to the base url instead of current url. So override the replaceState function to construct the full url based on current location Probably not needed very soon, as Authress-Engineering/openapi-explorer#292 was quickly merged
toy
added a commit
to opf/openproject
that referenced
this pull request
Dec 18, 2025
toy
added a commit
to opf/openproject
that referenced
this pull request
Dec 18, 2025
openapi-explorer uses pushState with anchor only, but this doesn't work with base tag, as anchor is added to the base url instead of current url. So override the replaceState function to construct the full url based on current location Probably not needed very soon, as Authress-Engineering/openapi-explorer#292 was quickly merged
toy
added a commit
to opf/openproject
that referenced
this pull request
Dec 18, 2025
toy
added a commit
to opf/openproject
that referenced
this pull request
Dec 19, 2025
openapi-explorer uses pushState with anchor only, but this doesn't work with base tag, as anchor is added to the base url instead of current url. So override the replaceState function to construct the full url based on current location Probably not needed very soon, as Authress-Engineering/openapi-explorer#292 was quickly merged
toy
added a commit
to opf/openproject
that referenced
this pull request
Dec 19, 2025
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.
Using only fragment works completely fine unless base tag is added in head (which makes also pushState urls be relative to it instead of to the current url). Fix by constructing complete url relative to current location.