When loading pending updates, consider scrolling to the "closest" one, not the latest one
As part of https://github.com/hypothesis/client/issues/6255, we implemented some logic to scroll the sidebar to display the most recent one of the new or updated annotations (see https://github.com/hypothesis/client/pull/6338 and https://github.com/hypothesis/client/pull/6337).
However, we have considered checking which is closest to the active viewport (if none of them are already inside of it) and scrolling to that one, to reduce viewport disruption as much as possible.
I'm not sure about this. Scrolling to the newest or oldest update seems like it would feel more predictable to me than scrolling to whichever happens to be nearest in the viewport - which could be at an arbitrary distance from the current viewport position.
I'm not sure about this. Scrolling to the newest or oldest update seems like it would feel more predictable to me than scrolling to whichever happens to be nearest in the viewport - which could be at an arbitrary distance from the current viewport position.
Yep, I tend to agree with this. After implementing it date-based, it does feel like the right approach.