-
Notifications
You must be signed in to change notification settings - Fork 49
navigate to complete url instead of only fragment/hash #292
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
navigate to complete url instead of only fragment/hash #292
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.
|
Can you provide a working reproduction of this problem? |
|
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> |
|
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! |
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 |
|
Cool, we support this change. |
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
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
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
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
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.