Created attachment 330367 [details]
I can reproduce this issue both on Safari 11.0.2 and Chrome 63.0.3239.84 on Mac OS 10.12.6.
The minimal reproducible code is attached (index.html):
Steps to reproduce:
1) Open index.html.
2) Open Web inspector.
3) Drag the 'scroll me' scrollbar to the right so that 'scroll me' text disappears.
4) In the inspector, change 'edit me' to e.g. 'x'.
Expected: scrollbar retains its position.
Observed: scrollbar resets the position (scrolls back to the left).
Other notes: changing the height of the scrollable container seems to affect how much to the left the scrollbar is rewound.
This issue seems to be somewhat related to https://bugs.webkit.org/show_bug.cgi?id=176458
Another observation: resizing the browser window horizontally with the same test case code will also reset the horizontal scrollbar position.