Skip to content

Scroll position lost after browser refresh / error popup #645

@yuhan0

Description

@yuhan0

Repro:

  • Have clerk show the following file on a small browser window such that it doesn't fit on a single page, and scroll to the bottom where the assoc block is visible.
(ns repro.scroll
  (:require [nextjournal.clerk :as clerk]))

:long
:document
:with
:lots
:of
:cells

(assoc {:current :position}
       :in :document
       ;; whoops
       )
       
(comment
  (clerk/show! *ns*))
  • Pretend to have made an error while editing the document by uncommenting the ;;whoops line
  • Save and eval clerk/show!
  • Browser page transforms into lots of scary red stacktraces
  • Fix the error by commenting the line back out.

Expected:

  • Last scroll position is preserved, such that the 'current' block being worked on remains visible.

Actual:

  • Scroll position is reset to top of page , user has to manually scroll back to where they were (usually at the bottom of a file)

Additional notes:

Scroll position should also be restored after showing a different namespace and returning back to the original, or after manually refreshing the page. (note that most websites display this behaviour)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions