Fix routing issues with subpages #3
Open
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.
The NavItem "url" attribute causes the browser to make a new request for the named page. Our website is (currently) set up as a Single Page Application (SPA) using the Yew router, and can't support direct server requests for the subpages*. In order to have the WASM application handle the request, the "onclick" attribute has to be used instead.
*unless the server is explicitly configured to serve index.html for unrecognized paths, which we can't do for GitHub Pages
References:
There were two additional details that needed to be fixed:
Tested using Apache as a static web server. Attempts to navigate with the navbar items from the existing code returned 404 errors. The same attempts to navigate with the code from this commit correctly return the appropriate page content.
There is one remaining issue. Switching from the "url" attribute to the "onclick" attribute has caused the cursor shape on mouseover to change: it is now a text selection icon rather than the typical hand icon. This is a poor behavior for UX and needs to be fixed.