Skip to content

[19.0] document_url: opening the attachment box scrolls the chatter to the bottom #664

Open

Description

Module: document_url 19.0.1.0.0

Steps to reproduce

  1. Open any record with a chatter that has several messages and at least one attachment.
  2. Click the paperclip in the chatter topbar.
  3. As soon as the thread recomputes its scroll (an image finishes loading, a resize), the chatter jumps to the very bottom, which is the oldest message.

Cause
static/src/js/url.esm.js overrides Chatter.onClickAddAttachments and sets
this.state.thread.scrollTop = 0. The chatter renders the thread with order="desc",
and there Thread.applyScroll reads a numeric scrollTop as the distance from the end
(scrollHeight - scrollTop - clientHeight), so 0 means "bottom of the list".
Core mail sets this.state.thread.scrollTop = "bottom", which for desc means the top.

Fix

         if (this.state.isAttachmentBoxOpened) {
             this.rootRef.el.scrollTop = 0;
-            this.state.thread.scrollTop = 0;
+            this.state.thread.scrollTop = "bottom";
         }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions