-
Notifications
You must be signed in to change notification settings - Fork 13
Description
When using relative links in embedded Draw.io diagrams, the target URL is sometimes constructed incorrectly on the first click. This leads to a broken link ("404 Not Found"). However, if the user navigates back and clicks the same link a second time, the URL is resolved correctly and the link works as expected.
To Reproduce
Steps to reproduce the behavior:
- Create a Draw.io diagram.
- Add a shape or text element.
- Assign a relative link to this element (e.g.,
../My-Other-Page). - Embed the diagram into an MkDocs page using the
mkdocs-drawio-plugin. - Build and serve the MkDocs site.
- Navigate to the page containing the diagram.
- Click the relative link for the first time.
Actual Behavior
The browser attempts to navigate to an incorrectly formed URL, which appears to be resolved against a base path rather than the full path of the current page.
Expected Behavior
The relative link should resolve correctly on the first click, navigating to the proper target page.
Example
Let's assume the current page URL is https://docs.example.com/project/section/sub-section/current-page/.
- Link in diagram:
../Target%20Page - URL on first click (Incorrect):
https://docs.example.com/project/Target%20Page - URL on second click (Correct):
https://docs.example.com/project/section/sub-section/Target%20Page/
Additional Context
This behavior suggests that the script handling the link redirection might not be correctly identifying the full base URL on the initial page load or first interaction, but successfully identifies it on subsequent attempts.