Repository navigation
Conversation
wenzhixin
commented
Nov 13, 2026
wenzhixin
left a comment
Owner
Author
There was a problem hiding this comment.
Pull request overview
This PR fixes the footer misalignment when horizontally scrolling a fixed-height table to the end (#7585): instead of inferring the vertical scrollbar via hasScrollBar && scrollHeight > clientHeight + headerHeight and using the globally measured Utils.getScrollBarWidth(), fitHeader()/fitFooter() now use the real occupied width fixedBody.offsetWidth - fixedBody.clientWidth, and resetView() re-fits the footer asynchronously once the container height has settled.
Changes:
src/modules/header.js: bothfitHeader()andfitFooter()computescrollWidthfrom the element's actualoffsetWidth - clientWidth, dropping the fragilehasScrollBar/scrollHeightinference and the global scrollbar-width measurement.src/modules/body.js:resetView()schedules a delayedfitFooter()(delay 0, via the existing_setDelayTimeout('footer', ...)) after applying the container height, because the vertical scrollbar is only rendered after the layout settles.
Reviewed changes
Reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/modules/header.js | fitHeader()/fitFooter() use the real scrollbar width (offsetWidth - clientWidth) |
| src/modules/body.js | resetView() re-fits the footer asynchronously after the height is applied |
Verification
fitFooter()computesscrollWidthidentically tofitHeader(), so header/footer/body stay consistent (src/modules/header.js:449-450 vs :258-259).offsetWidth - clientWidthis 0 when no vertical scrollbar is rendered, which preserves the no-scrollbar case without needinghasScrollBar(note:.fixed-table-bodyhasoverflow: auto, no border on the scroll container itself, so the subtraction isolates the scrollbar).- The delayed re-fit goes through
_setDelayTimeout('footer', ...)(src/bootstrap-table.js:76-79), which clears any pending footer timeout, anddestroy()clears all_timeoutIdentries, so no leak or stale callback after destroy.fitFooter()itself re-schedules at 100ms while hidden, same asfitHeader(). - The same
!cardView && showFooterguard is used as the synchronousfitFooter()call earlier inresetView(). hasScrollBaris still computed and consumed inresetView()for$tableBorder(src/modules/body.js:464, :504) — pre-existing, unrelated to this fix.- CI
Test/changes+Test/testgreen (552 unit tests). Static review only, no CI run locally.
Remaining notes (non-blocking)
tableBorderHeightstill subtracts the globalUtils.getScrollBarWidth()while the header/footer now use the measured width; on browsers where the two diverge (the exact case this PR fixes), the table border height may be off by the same difference. Worth a follow-up if misalignment of the bottom border is ever reported.
Recommendation: good to merge.
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔Type of Request
🔗Resolves an issue?
Fix #7585
Related to #6006, #7090, #7578
📝Changelog
margin-rightwas incorrectly calculated as0).Root cause
fitHeader()/fitFooter()inferred the vertical scrollbar's existence withhasScrollBar && scrollHeight > clientHeight + headerHeight, which can diverge from the browser's actual scrollbar rendering (e.g. Firefox on Windows), and used the globally measuredUtils.getScrollBarWidth()instead of the scrollbar's real occupied width. When the inference produced0, the footer'smargin-rightwas set to0while the body still reserved a scrollbar, so scrolling horizontally to the end misaligned the footer against the header/body columns (a phantom vertical scrollbar could also appear).Fix
fitHeader()/fitFooter()now use the real occupied width:fixedBody.offsetWidth - fixedBody.clientWidth.resetView()re-fits the footer asynchronously after the container height is applied (the scrollbar only exists once the layout settles; the synchronous call ran too early).Verified locally (A/B against CDN 1.23.5, same issue reproduction):
margin-right: 0px, footer right edge 15px past the body when scrolled to the end.margin-right: 15px, both aligned with the body.Compared to the draft #8419 (branch for #6006) which only dropped the
hasScrollBarcondition but kept the globalgetScrollBarWidth(), this uses the actual measured width and also fixes the footer fitting timing.💡Example(s)?
develop: footermargin-right: 0pxwhile the body reserves a 15px vertical scrollbar, so scrolling horizontally to the end leaves the footer 15px past the body)branch=bug/7585: footer/headermargin-right: 15px, the real scrollbar width, and header/body/footer stay aligned at the end of horizontal scrolling)Both examples force classic (space-taking) scrollbars via CSS so the behavior is visible on overlay-scrollbar platforms (e.g. macOS) too.
☑️Self Check before Merge