Skip to content

[AnalyticalTable]: Scroll position is pulled backwards causing non smooth scrolling #8997

Description

@Na1k

Describe the bug

AI Disclaimer: I used AI to reproduce the issue in Stackblitz but reviewed it manually thoroughly.

When using the AnalyticalTable and adding a lot of Cells / functionality / ... the performance can decrease. This is expected and documented. However, there seems to be a race condition in the table hook that is responsible for syncing the vertical scrollbar with the table body. As a result, the table gets "pulled back" when the user scrolls.

Expectation: Even when there is degraded performance (user on a low-resource machine), user scrolling shouldn't be "pulled back".

Please take a look at the stackblitz and try it out yourself. I'll append a video, but you can only really get a feeling for it when scrolling yourself. Also try CPU throttling, as this makes it more visible and reproduces browsers with less resources.

I'm going to fix this via a patch to useSyncScroll.
If you think this can be used as a fix, I'm happy to provide a PR. Please let me know in that case.

const lastWritten = useRef(new WeakMap<Element, number>());
const sync = (source) => {
 const sourceEl = source === 'content' ? content : scrollbar;
 const targetEl = source === 'content' ? scrollbar : content;
 const value = sourceEl.scrollTop;
 if (lastWritten.current.get(sourceEl) === value) {
   lastWritten.current.delete(sourceEl);   // this event is our own echo
   return;
 }
 if (targetEl.scrollTop !== value) {
   const prev = targetEl.scrollTop;
   targetEl.scrollTop = value;
   if (targetEl.scrollTop !== prev) lastWritten.current.set(targetEl, targetEl.scrollTop);
 }
};

Secondly, it could also be beneficial to expose the disable flag for the vertical scrollbar as a public prop so applications hitting this could opt-out (as it already is disabled when you are in Firefox).

Isolated Example

https://stackblitz.com/edit/github-eaqz8djy?file=src%2FApp.tsx

Reproduction steps

  1. Use a client with lower resources (or enable throttling in the DevTools)
  2. Implement a AnalyticalTable with some load / entries so there is a vertical scrollbar
  3. Scroll through the table
  4. When finishing a scroll, the table body gets "pulled back" by a few px decreasing the user experience and usability of the table

Expected Behaviour

Scrolling is smooth, no "pulling back"

Screenshots or Videos

2026-09-25_12-07-02.mp4

UI5 Web Components for React Version

2.27.1

UI5 Web Components Version

2.27.1

Browser

Chrome

Operating System

No response

Additional Context

No response

Relevant log output

Organization

No response

Declaration

  • I’m not disclosing any internal or sensitive information.

Activity

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

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions