Skip to content

TableView with overflowMode="wrap": Scroll position jumps to top after asynchronous loads #8132

Open
@obreitwi

Description

@obreitwi

Provide a general summary of the issue here

When using react-spectrum's TableView with an asynchronous list as data source and overflowMode set to "wrap", the TableView's scroll position jumps to the top on each trigger of onLoadMore.

🤔 Expected Behavior?

Same as with overflowMode="truncate", TableView should keep its (relative) vertical scrolling position after loading new data.

😯 Current Behavior

If overflowMode="wrap", TableView's vertical scroll position jumps to the top on each asynchronous load.

If overflowMode="truncate", TableView's vertical scroll position is kept unchanged and the user can continue scrolling.

💁 Possible Solution

After loading new data, the table layout is updated. During this, a check for updated columnWidths is performed.

However, we only check if the two columnWidths objects differ and not whether actual column widths are different, leading to an invalidation of all cached nodes in the corresponding Virtualizer.

🔦 Context

We are using TableView to display a lot of elements of varying row heights.

🖥️ Steps to Reproduce

(pending)

Version

3.41.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

Linux, Windows

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

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