react-component / react-component/table

自定义浏览器滚动条并且设置 scroll.y 时,如果数据内容较少,右侧仍旧会出现填充列。

Open
#998 7 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.4k
Forks
618
Avg merge
10h 19m
Merged PRs (30d)
2

Description

问题复现地址:

https://stackblitz.com/edit/react-ytlq4p?file=index.css,demo.tsx,index.tsx

问题描述:

当自定义浏览器滚动条时,并且设置 scroll.y,此时 rc-table 会在表头自动添加一列 xxx-cell-scrollbar,用于与自定义滚动条对齐。

但是当表格的数据量比较小时,表格内并没有出现滚动,还是会添加 xx-cell-scrollbar 列,并且表格内部会设置 overflow: scroll,样式会显得比较奇怪,如下:

image

期望:

希望能在表格内部未出现滚动的情况下,不自动添加该 scrollbar 列,并且 body 样式设置为 overflow: auto。

一点想法:

默认情况下不添加 scrollbar 列,用 rc-resize-observer 监听 body 是否滚动,渲染完成后,根据滚动状态来决定是否添加 scrollbar 列。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with index.tsx, demo.tsx, and index.css in the linked StackBlitz reproduction; run it with a small dataset, custom browser scrollbar, and scroll.y. Trace rc-table’s scrollbar-cell and body overflow behavior, then verify that no filler column appears when the body does not scroll and that the body uses overflow: auto.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.