Skip to content

Keep relative links working after loading a category in place - #445

Merged
iMattPro merged 2 commits into
phpbb:3.3.xfrom
ECYaz:fix/370-relative-links-ajax
Aug 3, 2026
Merged

Keep relative links working after loading a category in place#445
iMattPro merged 2 commits into
phpbb:3.3.xfrom
ECYaz:fix/370-relative-links-ajax

Conversation

@ECYaz

@ECYaz ECYaz commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #370

The fix converts the page's relative links and form actions to full URLs before the address changes, so they keep working no matter what category is loaded.

The category browser swaps the contribution list with AJAX and rewrites the
address to the category's URL, which usually sits at a different directory
depth. The board's own links are relative, so the browser re-resolves all of
them against the new path: from a deeper category, Board index turns into
customise/community/index.php on phpbb.com and the quick links, search and
FAQ shift the same way. A direct load of the category regenerates the links
at the right depth, which is why only the in-place navigation breaks.

Resolve the document's relative links and form actions against the address
it was rendered under before the first rewrite, so they keep pointing where
they did when the page loaded.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses #370 by preventing relative navigation URLs (links and form actions) from being re-resolved against a new, AJAX-updated history URL when a category is loaded in place—keeping core navigation (e.g., “Board index”) working after replaceUrl() changes the address bar.

Changes:

  • Adds a pre-replaceUrl() pass that converts certain relative href/action attributes to absolute URLs.
  • Keeps navigation behavior stable when AJAX category loading changes directory depth in the visible URL.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread assets/javascript/ajax.js Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@iMattPro
iMattPro merged commit f0304bc into phpbb:3.3.x Aug 3, 2026
6 checks passed
@ECYaz
ECYaz deleted the fix/370-relative-links-ajax branch August 3, 2026 22:49
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.

Default board links broken when expanding categories

3 participants