Fix instances where clicking a comment anchor twice will scroll to the wrong position
What does this MR do?
Currently we have a method which listens for hashchange
events to adjust scroll position after window.location.hash
is altered so we can account for the height of the navigation elements and adjust accordingly. However, this event does not fire when clicking on an anchor which already matches window.location.hash
. So clicking the same permalink twice in a row will only trigger this adjustment on the first click. This MR ensures that we adjust the scroll position on all #foo
style links whether window.location.hash
changes or not.
Are there points in the code the reviewer needs to double check?
Why was this MR needed?
Screenshots (if relevant)
Does this MR meet the acceptance criteria?
-
Changelog entry added -
Documentation created/updated -
API support added - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
What are the relevant issue numbers?
Closes #24876 (closed)