structurizr / ui

UI code for Structurizr Lite, on-premises, and cloud service.
https://docs.structurizr.com/ui
MIT License
43 stars 27 forks source link

Browser history is flooded when scrolling through generated documentation #12

Closed JulioC closed 1 year ago

JulioC commented 1 year ago

Description

When scrolling through a documentation page, the anchor link for the top-most visible header is added to the browser URL bar. This ends up flooding the browser history very quickly.

See:

Steps to reproduce

  1. Go to https://structurizr.com/share/31/documentation/Financial%20Risk%20System
  2. Scroll around
  3. Check your Back button in you browser

Screenshot

No response

Code sample

No response

Configuration

No response

Severity

Minor

Priority

Low

Resolution

I'm willing to fix this myself and raise a PR

More information

This is probably due to the code from documentation.jsp, linked below. It uses windows.history.pushState, which keeps track of the previous history state. Using replaceState would fix the issue.

https://github.com/structurizr/ui/blob/ec6b68c6417b97146d687c99e7fddd5b9dae4d40/src/jsp/documentation.jsp#L149