mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #7083] feat(clients): fit the table to the viewport so toolbar and scrollbar stay visible #6637
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6637
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/7083
Author: @Mo7amadd
Created: 11/5/2026
Status: 🔄 Open
Base:
main← Head:feat/clients-fit-table-height📝 Commits (1)
f6e42acfeat(clients): fit the table to the viewport so toolbar and scrollbar stay visible📊 Changes
2 files changed (+68 additions, -22 deletions)
View changed files
📝
frontend/src/pages/clients/ClientsPage.tsx(+28 -22)➕
frontend/src/pages/clients/useFitTableBodyHeight.ts(+40 -0)📄 Description
Summary
On desktop, the Clients table body now gets a height that fits the viewport (
scroll.y), so the rows scroll inside the table while the toolbar, the column headers, the horizontal scrollbar and the pagination stay on screen.Why
With 100 or 200 rows per page, the search/filter bar scrolls away immediately, and the horizontal scrollbar sits at the very bottom of the page. On a laptop you scroll to the end of the list just to move the table sideways, then back up to find the row again.
What changed
useFitTableBodyHeight.ts: measures where the table body starts and how much sits below the table inside its card (pagination, padding) and the page's bottom padding, and returnsviewport − those, with a 240px floor. It re-measures on window resize and, via aResizeObserveron every card in the content area, whenever something above the table changes size (filter chips, the selection bar). The hook takes the element from arefcallback, so it needs no effect of its own to wait for the DOM.ClientsPage.tsx: the desktop<Table>is wrapped in adivthat provides that element, andscrollgetsy: fitBodyHeight. antd then fixes the header and puts the scroller on the body, which is its standard layout for a bounded-height table.Type of change
Areas affected
How was this tested?
npm run typecheck,npm run lint,npm run format:check,npm run buildandnpm run build-storybookpass; the existing unit and component suites pass.npm run devwith a mocked API (120 clients): at 1280×650, 1366×768, 1440×820 and 1920×900, with 25 and 200 rows per page, the card's bottom edge stays 16px above the viewport bottom anddocument.scrollingElement.scrollHeight === innerHeight(no page scrollbar); resizing the window, adding and removing filter chips, and switching to and from the mobile breakpoint all re-fit the table.Screenshots / recordings
Breaking changes
None functionally. Visually, rows now scroll inside the table on desktop instead of with the page.
Checklist
go build ./...and the test suite pass locally. (Frontend-only change; no Go code touched, so the Go suite was not run.)npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.