Skip to content

Scrolling broken after upgrade from v2.23.1 to v2.24.0 #362

@Gregg8

Description

@Gregg8

After upgrading a re-com/re-frame app from an old re-com version v2.21.0 to v2.28.2, scrollIntoView calls via reagent/after-render no longer work. Elements cannot be found in the DOM when the scroll effect runs.

On bisecting re-com versions, it turns out that v2.24.0 is the culprit.

Reproduction:

In an app using re-com components, trigger a scroll to an element after a state change:

(defn scroll-to-top
  [elem]
  (when elem
    (.scrollIntoView elem (clj->js {:block  "start"
                                    :inline "nearest"}))))

(reg-fx
  :set-scroll-position
  (fn [panel-id]
    (reagent/after-render
      (fn []
        (scroll-to-top (get-element-by-id panel-id))))))

With v2.23.1: element is found and scrolled to.
With v2.24.0: element is not found in the DOM at the time after-render fires.

Metadata

Metadata

Assignees

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