problem scenario
When using antd with a scroll bar, sometimes when tbody
the height ≤ y
value, the vertical scroll bar will only leave the scroll bar background, and the scroll bar will disappear (as shown below) (sometimes the empty state will also have problems); only when When tbody
the height of is higher than y
the value, the vertical scroll bar will be displayed normally. If the style of the scroll bar is modified in the project, there may be unsightly problems.
<Table
columns={
columns}
dataSource={
data}
scroll={
{
x: 1500,
y: 500
}}
/>
Causes and Solutions
The overflow in antd is:
overflow: auto scroll;
The y-axis scroll
is causing the problem.
Just change the properties of the y-axis as well auto
.
.ant-table-body {
overflow: auto !important;
}