Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 5, 2025

The "Unpin" menu item in the column dropdown was misaligned compared to other menu items like "Pin to right" and "Unsort". The text appeared further to the left, creating an inconsistent visual appearance.

Root Cause

The issue was in GridColumnMenuPinningItem.tsx where the "Unpin" menu item used iconStart="" (empty string). Since empty string is falsy, the BaseMenuItem component doesn't render the ListItemIcon container, causing the text to start at the left edge instead of being properly aligned.

Solution

Changed iconStart="" to iconStart={<span />} for the "Unpin" menu item. The <span /> element is truthy, so the BaseMenuItem component renders the ListItemIcon container, creating consistent spacing with other menu items that have actual icons.

Before:

<rootProps.slots.baseMenuItem onClick={unpinColumn} iconStart="">

After:

<rootProps.slots.baseMenuItem onClick={unpinColumn} iconStart={<span />}>

Testing

  • All existing column pinning tests continue to pass (46 tests, 6 skipped)

Fixes #19428.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@MBilalShafi MBilalShafi changed the title [WIP] [data grid] Column Dropdown Menu Unpin Text Alignment [WIP] [DataGridPro] Column Dropdown Menu Unpin Text Alignment Sep 5, 2025
@MBilalShafi MBilalShafi added scope: data grid Changes related to the data grid. feature: Column pinning Related to the data grid Column pinning feature design: ui Visual design. labels Sep 5, 2025
@mui-bot
Copy link

mui-bot commented Sep 5, 2025

Deploy preview: https://deploy-preview-19462--material-ui-x.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 🔺+10B(0.00%) 🔺+8B(+0.01%)
@mui/x-data-grid-premium 🔺+10B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 🔺+3B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 🔺+4B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 🔺+2B(+0.01%)

Details of bundle changes

Generated by 🚫 dangerJS against 9a9d476

Copilot AI changed the title [WIP] [DataGridPro] Column Dropdown Menu Unpin Text Alignment [data grid] Fix column dropdown menu "Unpin" text alignment Sep 5, 2025
Copilot AI requested a review from MBilalShafi September 5, 2025 21:25
Copilot finished work on behalf of MBilalShafi September 5, 2025 21:25
Copilot AI requested a review from MBilalShafi September 5, 2025 21:32
Copilot finished work on behalf of MBilalShafi September 5, 2025 21:32
@MBilalShafi MBilalShafi marked this pull request as ready for review September 6, 2025 13:10
@MBilalShafi MBilalShafi added the type: bug It doesn't behave as expected. label Sep 6, 2025
@MBilalShafi MBilalShafi requested a review from a team September 8, 2025 15:49
@arminmeh arminmeh changed the title [data grid] Fix column dropdown menu "Unpin" text alignment [DataGrid] Fix column dropdown menu "Unpin" text alignment Sep 8, 2025
@MBilalShafi MBilalShafi merged commit 00e093c into master Sep 8, 2025
23 of 24 checks passed
@MBilalShafi MBilalShafi deleted the copilot/fix-19428 branch September 8, 2025 16:33
JCQuintas pushed a commit to JCQuintas/mui-x that referenced this pull request Sep 15, 2025
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: MBilalShafi <[email protected]>
Co-authored-by: Bilal Shafi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

design: ui Visual design. feature: Column pinning Related to the data grid Column pinning feature scope: data grid Changes related to the data grid. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[data grid] Column Dropdown Menu Unpin Text Alignment

4 participants