Skip to content

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?

What are the relevant issue numbers?

Closes #24876 (closed)

Merge request reports