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

[DataGrid] Fix document reference when the grid is rendered in a popup window #14649

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

arminmeh
Copy link
Contributor

@arminmeh arminmeh commented Sep 17, 2024

Fixes #14591

Initially, the root element reference is null.

In useEffect that runs on init the document reference will point to the main window's document, since this util is being used to get it.

Issue will not be visible unless the grid is actually rendered in another window (popup). In that case, some event listeners will end up being attached to the wrong document.

Callbacks and other event handlers that are triggered after user actions are fine, since the reference is there by that time.

I have updated all places where ownerDocument is being used on first render.

@arminmeh arminmeh added bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Editing Related to the data grid Editing feature feature: Cell Selection Related to the cell selection feature labels Sep 17, 2024
@arminmeh arminmeh requested a review from a team September 17, 2024 10:25
@mui-bot
Copy link

mui-bot commented Sep 17, 2024

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

Generated by 🚫 dangerJS against bf04188

@arminmeh arminmeh enabled auto-merge (squash) September 17, 2024 10:52
Copy link
Member

@MBilalShafi MBilalShafi left a comment

Choose a reason for hiding this comment

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

LGTM

@arminmeh arminmeh merged commit 6f6a7fe into mui:master Sep 17, 2024
26 checks passed
@arminmeh arminmeh deleted the fix-document-reference branch September 17, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Cell Selection Related to the cell selection feature feature: Editing Related to the data grid Editing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] setting apiRef.current.rootElementRef
3 participants