-
-
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
[DataGrid] Workaround for failing jsdom tests caused by :has
selectors
#14559
Changes from all commits
2ff55cd
fac91b3
8dc82f8
bcca78e
2778120
c44e589
78993d9
fb005c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -274,6 +274,17 @@ export const useGridColumnHeaders = (props: UseGridColumnHeadersProps) => { | |
computedWidth: colDef.computedWidth, | ||
}); | ||
|
||
const siblingWithBorderingSeparator = | ||
pinnedPosition === GridPinnedColumnPosition.RIGHT | ||
? renderedColumns[i - 1] | ||
: renderedColumns[i + 1]; | ||
const isSiblingFocused = siblingWithBorderingSeparator | ||
? columnHeaderFocus !== null && | ||
columnHeaderFocus.field === siblingWithBorderingSeparator.field | ||
: false; | ||
const isLastUnpinned = | ||
columnIndex + 1 === columnPositions.length - pinnedColumns.right.length; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the conditions above be different for LTR and RTL? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @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. |
||
columns.push( | ||
<GridColumnHeaderItem | ||
key={colDef.field} | ||
|
@@ -295,6 +306,8 @@ export const useGridColumnHeaders = (props: UseGridColumnHeadersProps) => { | |
indexInSection={i} | ||
sectionLength={renderedColumns.length} | ||
gridHasFiller={gridHasFiller} | ||
isLastUnpinned={isLastUnpinned} | ||
isSiblingFocused={isSiblingFocused} | ||
{...other} | ||
/>, | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.