Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataGridPro] Render pinned and non-pinned column headers in one row #12376

Merged
merged 59 commits into from
Mar 13, 2024

Conversation

cherniavskii
Copy link
Member

@cherniavskii cherniavskii commented Mar 8, 2024

Closes #11949

TODO:

  • Make unit tests pass
  • Update migration guide

Changelog

Breaking changes

  • The columnHeader--showColumnBorder class was replaced by columnHeader--withLeftBorder and columnHeader--withRightBorder.
  • The columnHeadersInner, columnHeadersInner--scrollable, and columnHeaderDropZone classes were removed since the inner wrapper was removed in our effort to simplify the DOM structure and improve accessibility.
  • The pinnedColumnHeaders, pinnedColumnHeaders--left, and pinnedColumnHeaders--right classes were removed along with the element they were applied to.
    The pinned column headers now use position: 'sticky' and are rendered in the same row element as the regular column headers.

@cherniavskii cherniavskii added bug 🐛 Something doesn't work accessibility a11y component: data grid This is the name of the generic UI component, not the React module! feature: Column groups Related to the data grid Column groups feature feature: Column pinning Related to the data grid Column pinning feature feature: Filtering on header Related to the header filtering (Pro) feature MUI X Pro labels Mar 8, 2024
@mui-bot
Copy link

mui-bot commented Mar 8, 2024

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 12, 2024

This comment was marked as outdated.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 12, 2024
@@ -533,7 +522,7 @@ const GridRow = React.forwardRef<HTMLDivElement, GridRowProps>(function GridRow(
/>
{cells}
{emptyCellWidth > 0 && <EmptyCell width={emptyCellWidth} />}
{rightCells.length > 0 && <div role="presentation" style={{ flex: '1' }} />}
{rightCells.length > 0 && <div role="presentation" className={gridClasses.filler} />}
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved inline styles to GridRootStyles since the filler is rendered for every row

@cherniavskii cherniavskii requested a review from romgrk March 12, 2024 18:52
@@ -77,10 +77,6 @@ export interface GridCorePrivateApi<
* The React ref of the grid column container virtualized div element.
*/
columnHeadersContainerElementRef?: React.RefObject<HTMLDivElement>;
Copy link
Contributor

Choose a reason for hiding this comment

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

We could refactor this one to columnHeadersContainerRef, long names aren't great for readability.

import { gridColumnsTotalWidthSelector } from '../hooks/features/columns/gridColumnsSelector';
import { GridScrollParams } from '../models/params/gridScrollParams';
import { GridEventListener } from '../models/events';
import { useTimeout } from '../hooks/utils/useTimeout';
Copy link
Contributor

Choose a reason for hiding this comment

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

We have it in @mui/utils/useTimeout now I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, also for the useLazyRef and useOnMount hooks.
Plus, did the same in @mui/x-tree-view

@@ -1024,12 +1024,6 @@
"description": "Styles applied to the selection checkbox element.",
"isGlobal": false
},
{
"key": "columnGroupHeader",
Copy link
Member Author

Choose a reason for hiding this comment

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

Wasn't used in the codebase

@cherniavskii cherniavskii enabled auto-merge (squash) March 13, 2024 16:11
@cherniavskii cherniavskii merged commit 684fca7 into mui:next Mar 13, 2024
16 checks passed
@cherniavskii cherniavskii deleted the sticky-pinned-column-headers branch March 13, 2024 17:24
@oliviertassinari oliviertassinari added plan: Pro Impact at least one Pro user and removed MUI X Pro labels Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility a11y breaking change bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Column groups Related to the data grid Column groups feature feature: Column pinning Related to the data grid Column pinning feature feature: Filtering on header Related to the header filtering (Pro) feature plan: Pro Impact at least one Pro user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] Screen reader reads wrong column / row when using column pinning feature
4 participants