adobe / react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
https://react-spectrum.adobe.com
Apache License 2.0
12.88k stars 1.12k forks source link

If the maxWidth of the last column of a TableView is specified, then the table does not layout correctly. #2259

Closed PlanckTimeGames closed 1 year ago

PlanckTimeGames commented 3 years ago

๐Ÿ› Bug Report

If I specify the maxWidth of the last column of a TableView, then the table does not fill its container. If I specify the maxWidth of any other column except the last one, then the table expands correctly. See codesandbox snippet: https://codesandbox.io/s/unruffled-keldysh-d28rz?file=/src/App.js See image: image

๐Ÿค” Expected Behavior

If the maxWidth of the last column is set, then the remaining columns should expand such that the table fills its container properly.

๐Ÿ˜ฏ Current Behavior

If the maxWidth of the last column of a TableView is specified, then the table does not fill its container.

๐Ÿ’ Possible Solution

Needs some fixes in layout calculation.

๐Ÿ”ฆ Context

I am making a table that needs to have smaller columns on the right side. This bug makes my table look ugly.

๐Ÿ’ป Code Sample

https://codesandbox.io/s/unruffled-keldysh-d28rz?file=/src/App.js

๐ŸŒ Your Environment

Software Version(s)
react-spectrum/table 3.0.0.rc.1
Browser All
Operating System All

๐Ÿงข Your Company/Team

Adobe Acrobat

LFDanLu commented 3 years ago

Point of investigation: https://github.com/adobe/react-spectrum/blob/840ef4fc8fd1dd896a37b581829e954dfa5d3392/packages/%40react-stately/layout/src/TableLayout.ts#L66-L108

snowystinger commented 1 year ago

Looks like this was fixed at some point, I can't reproduce anymore https://codesandbox.io/s/immutable-feather-kstxgz?file=/src/App.js