material-react-table icon indicating copy to clipboard operation
material-react-table copied to clipboard

Table Scrolling automatically to top when resizing the column when row virtualization is enabled

Open adil0320 opened this issue 6 months ago • 0 comments

material-react-table version

2.13.0

react & react-dom versions

18.2.0

Describe the bug and the steps to reproduce it

Table automatically scrolled to top when i resize the column

This only happened when the row virtualization is enabled.

Minimal, Reproducible Example - (Optional, but Recommended)

`import { useMemo } from 'react'; import { MaterialReactTable, useMaterialReactTable, type MRT_ColumnDef, } from 'material-react-table'; import { data, type Person } from './makeData';

const Example = () => { const columns = useMemo<MRT_ColumnDef<Person>[]>( () => [ { accessorKey: 'firstName', header: 'First Name', //uses the default width from defaultColumn prop }, { accessorKey: 'lastName', header: 'Last Name', }, { accessorKey: 'email', header: 'Email Address', size: 250, //increase the width of this column }, { accessorKey: 'city', header: 'City', size: 200, //decrease the width of this column enableResizing: false, //disable resizing for this column }, { accessorKey: 'country', header: 'Country', size: 140, //decrease the width of this column }, ], [], );

const table = useMaterialReactTable({ columns, data, //optionally override the default column widths defaultColumn: { maxSize: 400, minSize: 80, size: 160, //default size is usually 180 }, enableColumnResizing: true, columnResizeMode: 'onChange', //default enableStickyHeader:true, enableRowVirtualization: true, rowVirtualizerOptions: { overscan: 10, }, });

return <MaterialReactTable table={table} />; };

export default Example; `

Screenshots or Videos (Optional)

Screencast: https://github.com/user-attachments/assets/49841413-761d-4ef9-90c8-33fd232214e6

Do you intend to try to help solve this bug with your own PR?

None

Terms

  • [x] I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

adil0320 avatar Jul 21 '25 07:07 adil0320