-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[data grid] filter and columns poppers incorrectly positioned when using a toolbar #13442
Comments
Hey @jcrang The fix would be a rather easy one, so I am opening it up as a good first issue. diff --git a/packages/x-data-grid/src/components/containers/GridRoot.tsx b/packages/x-data-grid/src/components/containers/GridRoot.tsx
index d141c5a0f..62a777499 100644
--- a/packages/x-data-grid/src/components/containers/GridRoot.tsx
+++ b/packages/x-data-grid/src/components/containers/GridRoot.tsx
@@ -45,15 +45,9 @@ const useUtilityClasses = (ownerState: OwnerState) => {
return composeClasses(slots, getDataGridUtilityClass, classes);
};
-const GridPanelAnchor = styled('div')({
- position: 'absolute',
- top: `var(--DataGrid-headersTotalHeight)`,
- left: 0,
-});
-
const GridRoot = React.forwardRef<HTMLDivElement, GridRootProps>(function GridRoot(props, ref) {
const rootProps = useGridRootProps();
- const { children, className, ...other } = props;
+ const { className, ...other } = props;
const apiRef = useGridPrivateApiContext();
const density = useGridSelector(apiRef, gridDensitySelector);
const rootElementRef = apiRef.current.rootElementRef;
@@ -82,10 +76,7 @@ const GridRoot = React.forwardRef<HTMLDivElement, GridRootProps>(function GridRo
className={clsx(className, classes.root)}
ownerState={ownerState}
{...other}
- >
- <GridPanelAnchor role="presentation" data-id="gridPanelAnchor" />
- {children}
- </GridRootStyles>
+ />
);
});
diff --git a/packages/x-data-grid/src/components/virtualization/GridTopContainer.tsx b/packages/x-data-grid/src/components/virtualization/GridTopContainer.tsx
index 88603b41c..fad36864b 100644
--- a/packages/x-data-grid/src/components/virtualization/GridTopContainer.tsx
+++ b/packages/x-data-grid/src/components/virtualization/GridTopContainer.tsx
@@ -4,6 +4,12 @@ import { styled } from '@mui/system';
import { unstable_composeClasses as composeClasses } from '@mui/utils';
import { gridClasses, getDataGridUtilityClass } from '../../constants/gridClasses';
+const GridPanelAnchor = styled('div')({
+ position: 'absolute',
+ top: `var(--DataGrid-headersTotalHeight)`,
+ left: 0,
+});
+
const useUtilityClasses = () => {
const slots = {
root: ['topContainer'],
@@ -29,13 +35,17 @@ const Element = styled('div')({
});
export function GridTopContainer(props: React.HTMLAttributes<HTMLDivElement>) {
+ const { children, ...otherProps } = props;
const classes = useUtilityClasses();
return (
<Element
- {...props}
- className={clsx(classes.root, props.className, gridClasses['container--top'])}
+ {...otherProps}
+ className={clsx(classes.root, otherProps.className, gridClasses['container--top'])}
role="presentation"
- />
+ >
+ {children}
+ <GridPanelAnchor role="presentation" data-id="gridPanelAnchor" />
+ </Element>
);
} |
@jcrang: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
Steps to reproduce
Link to live example: (required)
https://codesandbox.io/p/sandbox/relaxed-frost-vsxqk5?file=%2Fsrc%2FDemo.tsx
Steps:
Note: this only occurs when using a toolbar. Poppers are correctly positioned when not using a toolbar.
Current behavior
Position of popper obscures headers
Expected behavior
Position of popper is below headers (as in MUI X 6):
https://codesandbox.io/p/sandbox/great-tree-hqkwng?file=%2Fsrc%2FDemo.tsx
Context
No response
Your environment
No response
Search keywords: datagrid toolbar popper
The text was updated successfully, but these errors were encountered: