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

[data grid] Fix column resize not working with special character #13069

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

oukunan
Copy link
Contributor

@oukunan oukunan commented May 9, 2024

@oukunan oukunan force-pushed the fix-column-resize-special-characters branch from 059ce2f to 23c6693 Compare May 9, 2024 15:52
@oukunan oukunan changed the title [DataGrid] Fix column resize not working with special character Fix column resize not working with special character May 9, 2024
@oukunan oukunan changed the title Fix column resize not working with special character [DataGrid] Fix column resize not working with special character May 9, 2024
@zannager zannager added the component: data grid This is the name of the generic UI component, not the React module! label May 10, 2024
@mui-bot
Copy link

mui-bot commented May 10, 2024

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

Generated by 🚫 dangerJS against c65edbb

@romgrk romgrk requested a review from cherniavskii May 16, 2024 17:14
@romgrk
Copy link
Contributor

romgrk commented May 16, 2024

@cherniavskii I'll let you approve & merge.

Copy link
Member

@cherniavskii cherniavskii left a comment

Choose a reason for hiding this comment

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

Thank you!

@oliviertassinari oliviertassinari changed the title [DataGrid] Fix column resize not working with special character [data grid] Fix column resize not working with special character May 25, 2024
);
if (headerFilterElement) {
refs.headerFilterElement = headerFilterElement as HTMLDivElement;
}

refs.groupHeaderElements = findGroupHeaderElementsFromField(
apiRef.current.columnHeadersContainerRef?.current!,
colDef.field,
escapedColDefField,
Copy link
Member

Choose a reason for hiding this comment

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

I think that the escaping should happen in findGroupHeaderElementsFromField(). Otherwise, we will reintroduce the bug the next time the function is used.

Same with findHeaderElementFromField

// HACK: The jsdom test is failing because CSS.escape doesn't exist in that context.
// We have decided that we want to preserve the bug in jsdom
// https://github.com/mui/mui-x/pull/13069#discussion_r1603270444
const escapedColDefField = typeof CSS === 'undefined' ? colDef.field : CSS.escape(colDef.field);
Copy link
Member

Choose a reason for hiding this comment

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

This is inconsistent with #2033. To normalize to have one solution for one problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, use the existing escapeOperandAttributeSelector function instead of CSS.escape.

Copy link
Member

Choose a reason for hiding this comment

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

Why not standardize on CSS.escape?

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

There are more selectors to fix, e.g.

  • findGridHeader
  • findGridCells

@oukunan oukunan force-pushed the fix-column-resize-special-characters branch from c65edbb to 0ee6603 Compare May 26, 2024 06:32
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: Column resize
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] Column resizing not working with special characters in column names
6 participants