Skip to content

Comments

fix(plugin-chart-table): remove column misalignment when no scrollbars are present#36891

Merged
EnxDev merged 1 commit intomasterfrom
enxdev/fix/chart-table
Jan 5, 2026
Merged

fix(plugin-chart-table): remove column misalignment when no scrollbars are present#36891
EnxDev merged 1 commit intomasterfrom
enxdev/fix/chart-table

Conversation

@EnxDev
Copy link
Contributor

@EnxDev EnxDev commented Jan 3, 2026

User description

SUMMARY

This PR fixes a column misalignment issue in the Table chart when no scrollbars are present. The fix ensures consistent width calculation between header and body containers across all scrollbar scenarios.

Background

The Table chart's sticky header implementation has gone through several iterations to handle scrollbar-related alignment issues:

The Problem

After PR #36190, a new edge case emerged: when no scrollbars are present (table fits entirely within its container), the columns become misaligned. This happens because:

  • Header: Uses maxWidth (since hasVerticalScroll is false, no subtraction occurs)
  • Body: Uses maxWidth + scrollbarGutter: 'stable' (always reserves ~8px for scrollbar)

The body reserves space for a scrollbar that doesn't exist, making its content area narrower than the header's, causing visible column misalignment.

The Solution

Conditionally apply scrollbarGutter: 'stable' only when hasVerticalScroll is true:

Fixes #36370 #36185

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

  • Before: with vertical scrollbar, no horizontal scroll and no vertical scroll
before.mp4
Screenshot 2026-01-03 132059 Screenshot 2026-01-03 132051 Screenshot 2026-01-03 132003
  • After: with vertical scrollbar, no horizontal scroll and no vertical scroll.
after.mp4
Screenshot 2026-01-03 131904 Screenshot 2026-01-03 131856 Screenshot 2026-01-03 131851

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

CodeAnt-AI Description

Fix column misalignment in Table when no vertical scrollbar

What Changed

  • The table body no longer reserves invisible scrollbar space when there is no vertical scrollbar, so header and body column widths match.
  • Tables that fit entirely within their container no longer show a subtle right-side gap or shifted columns.
  • Behavior remains unchanged when a vertical scrollbar is present (scrollbar space is still accounted for to keep alignment).

Impact

✅ Fewer misaligned table columns
✅ Consistent table layout when no scrollbar is visible
✅ No unexpected blank gap on the right of tables

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 3, 2026

Code Review Agent Run #1361df

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 57bc041..57bc041
    • superset-frontend/plugins/plugin-chart-table/src/DataTable/hooks/useSticky.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai-for-open-source codeant-ai-for-open-source bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Jan 3, 2026
@codeant-ai-for-open-source
Copy link
Contributor

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Sizer still forces gutter
    The hidden sizer container still unconditionally sets scrollbarGutter: 'stable'. That may reserve scrollbar space during measurement even when hasVerticalScroll is false, causing the very misalignment this PR is trying to fix. Verify whether the sizer should also use the same conditional logic.

height: bodyHeight,
overflow: 'auto',
scrollbarGutter: 'stable',
scrollbarGutter: hasVerticalScroll ? 'stable' : undefined,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Inconsistency with sizer: the sizer container always used scrollbarGutter: 'stable' earlier, while the body used a conditional; this can create transient layout differences. Make the body use scrollbarGutter: 'stable' unconditionally to match the sizer and avoid inconsistent measurements. [possible bug]

Severity Level: Critical 🚨

Suggested change
scrollbarGutter: hasVerticalScroll ? 'stable' : undefined,
scrollbarGutter: 'stable',
Why it matters? ⭐

Making the body use scrollbarGutter: 'stable' unconditionally matches the sizer's behavior and avoids transient measurement differences.
This change is a targeted fix for inconsistent measurements introduced by the PR and is likely to reduce header/body width shifts in browsers that support the property.
It's a small, verifiable layout improvement and does not introduce the feature-detection complexity of a fallback.

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/plugins/plugin-chart-table/src/DataTable/hooks/useSticky.tsx
**Line:** 347:347
**Comment:**
	*Possible Bug: Inconsistency with sizer: the sizer container always used `scrollbarGutter: 'stable'` earlier, while the body used a conditional; this can create transient layout differences. Make the body use `scrollbarGutter: 'stable'` unconditionally to match the sizer and avoid inconsistent measurements.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI finished reviewing your PR.

Copy link
Contributor

@alexandrusoare alexandrusoare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@EnxDev EnxDev merged commit 740ddc0 into master Jan 5, 2026
82 of 83 checks passed
@EnxDev EnxDev deleted the enxdev/fix/chart-table branch January 5, 2026 12:52
sadpandajoe pushed a commit that referenced this pull request Jan 5, 2026
@sadpandajoe sadpandajoe added the v6.0 Label added by the release manager to track PRs to be included in the 6.0 branch label Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugins size/XS size:XS This PR changes 0-9 lines, ignoring generated files v6.0 Label added by the release manager to track PRs to be included in the 6.0 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

table header and content misalignment

5 participants