Feature request: side by side view or "sticky blocks"

When I code on a visualization in RStudio, I can see the code on the left and the graphic on the right. I get that this is harder to do with Observable, but the current solution involves constantly scrolling up and down to see the effect of code changes further down on the page. I found this rather annoying while trying Observable.

In some way this is even more annoying than to [Alt]-[Tabbing] between a code editor and a (hot reloading) browser preview, because it involves switching from keyboard to mouse.

Perhaps certain blocks can be made “sticky” so they are visible no matter where I scrolled to on the page. Or there’s an optional “side by side” view that I can scroll to a different position, just like the split view in Excel. My hunch is that sticky blocks are probably better performing, though.

5 Likes

Gregor!

We’re thinking about ways to make certain cells sticky (and other layout options) — but in the meantime, there’s another trick you can use which works a treat:

Open your notebook in a second window, and place it alongside the first one. Changes to the code are synchronized between open notebooks, so you can edit in one — and observe / twiddle with sliders independently in the other…

12 Likes

ah, very nice! that does the trick!

This makes working on a laptop so much better! A++ hack.

Something like this?

4 Likes

Let me also add, for anyone who wants to use this type of layout: try opening the first window in “safe mode” (add /safe to the URL), which will hide all of the cell displays (indeed, prevent them from even being evaluated) and just show the code. Then unpin all the code listings in the second window, so you only see the rendered output.

4 Likes

if you’re talking about seeing the display as you modify the code, the current suggested workaround is to open the notebook in different windows. Changes between them are synced:

Many thanks to you; I’m a latecomer that’s rediscovered this technique today; but as the relief from that is still fresh in my mind I thought I should mention it.

Naturally I’m loving observable; however the loss of position when re-evaluating or upon scrolling was too frequently taking me out of flow.

Hopefully flagging this technique again - or more prominently somehow - will also be good for others.

Best wishes !

1 Like