[DataGrid] Workaround for failing jsdom tests caused by :has selectors#14559
[DataGrid] Workaround for failing jsdom tests caused by :has selectors#14559kenanyusuf merged 8 commits intomui:masterfrom
:has selectors#14559Conversation
…und jsdom/nwsapi bug
|
Deploy preview: https://deploy-preview-14559--material-ui-x.netlify.app/ |
| [`& .${c.columnHeader}:focus, | ||
| & .${c.columnHeader}:focus-within, | ||
| & .${c.columnHeader}:has(+ .${c.columnHeader}:focus), | ||
| & .${c.columnHeader}:has(+ .${c.columnHeader}:focus-within), |
There was a problem hiding this comment.
I did not attempt to work around the focus-within selectors, as I don't think it is worth the added JS to replicate this effect.
| : false; | ||
| const isLastUnpinned = | ||
| columnIndex + 1 === columnPositions.length - 1 - (pinnedColumns.right.length - 1); | ||
|
|
There was a problem hiding this comment.
Should the conditions above be different for LTR and RTL?
There was a problem hiding this comment.
@cherniavskii Good point, though from testing this, it looks like we've got a bigger problem to solve with pinned columns + RTL 😬
There was a problem hiding this comment.
Looks like we have an issue open for this already #14245
I'll take a look at that next.
There was a problem hiding this comment.
@cherniavskii tested this with the changes from #14586 and these conditions are working as expected as they are - I don't think we need to adjust these for RTL.
There was a problem hiding this comment.
Could we add comments somewhere to explain those props/styles are a workaround for jsdom?
This PR is working around an issue with
nwsapiwhere:hasselectors are not being parsed correctly.nwsapiis a dependency ofjsdom, so users are experiencing tests failing as a result. We can potentially undo these changes once the issue is fixed there.The temporary solution is to remove the
:hasselectors and to use modifier classes on the column headers to achieve the same result.Fixes #14517