# Page scrolls to top when generator updates

**URL:** <https://talk.observablehq.com/t/page-scrolls-to-top-when-generator-updates/9382>\
**Category:** Help\
**Created:** [June 11, 2024, 11:34am UTC](https://talk.observablehq.com/t/page-scrolls-to-top-when-generator-updates/9382 "2024-06-11T11:34:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremy9959](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/jeremy9959/32/3059_2.png) [@jeremy9959](https://talk.observablehq.com/u/jeremy9959)\
**Post date:** [June 11, 2024, 11:34am UTC](https://talk.observablehq.com/t/page-scrolls-to-top-when-generator-updates/9382/1 "2024-06-11T11:34:24Z")

</div>

Hi, I’m working on this little app as an exercise to learn the framework:  
[https://jeremy9959.observablehq.cloud/sampling/](https://jeremy9959.observablehq.cloud/sampling/)  
On a small mobile screen,  
the two graphs stack one on top of the other as they should. However, every time the  
animation updates, the window scrolls back to the top. As a result you really can’t ever see the second graph.

This is probably more of a general javascript question than an observable one, but is there a way to prevent the graph update ticks from triggering a scroll-to-top action?

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [June 11, 2024, 12:13pm UTC](https://talk.observablehq.com/t/page-scrolls-to-top-when-generator-updates/9382/2 "2024-06-11T12:13:41Z")

</div>

On which device and browser do you see that happen?

---

<div class="post-metadata">

**Author:** ![jeremy9959](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/jeremy9959/32/3059_2.png) [@jeremy9959](https://talk.observablehq.com/u/jeremy9959)\
**Post date:** [June 11, 2024, 12:14pm UTC](https://talk.observablehq.com/t/page-scrolls-to-top-when-generator-updates/9382/3 "2024-06-11T12:14:52Z")

</div>

Iphone; safari.

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [June 11, 2024, 12:52pm UTC](https://talk.observablehq.com/t/page-scrolls-to-top-when-generator-updates/9382/4 "2024-06-11T12:52:32Z")

</div>

The good news is that the issue seems to be limited to Safari; both Chrome and Firefox handle scroll anchoring just fine.

Which version of Framework are you using?

---

<div class="post-metadata">

**Author:** ![jeremy9959](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/jeremy9959/32/3059_2.png) [@jeremy9959](https://talk.observablehq.com/u/jeremy9959)\
**Post date:** [June 11, 2024, 1:16pm UTC](https://talk.observablehq.com/t/page-scrolls-to-top-when-generator-updates/9382/5 "2024-06-11T13:16:40Z")

</div>

v1.8.0.

It didn’t occur to me that this was a bug or I would have been more systematic about reporting all of this.

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [June 11, 2024, 1:57pm UTC](https://talk.observablehq.com/t/page-scrolls-to-top-when-generator-updates/9382/6 "2024-06-11T13:57:57Z")

</div>

For what it’s worth, this is the Webkit issue: [171099 – Implement scroll anchoring](https://bugs.webkit.org/show_bug.cgi?id=171099)

I’m not sure what workarounds exist. Perhaps you can interpolate your chart in a container with a fixed height or aspect-ratio (that is, outside of a code block) so that the root height is unaffected when the chart element gets replaced.

---

<div class="post-metadata">

**Author:** ![jeremy9959](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/jeremy9959/32/3059_2.png) [@jeremy9959](https://talk.observablehq.com/u/jeremy9959)\
**Post date:** [June 11, 2024, 2:13pm UTC](https://talk.observablehq.com/t/page-scrolls-to-top-when-generator-updates/9382/7 "2024-06-11T14:13:16Z")

</div>

I think I will just file this away under “mysterious problem to someday understand” and move on 🙂
