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

[EuiDataGrid] Sorting popover scrollbar CSS bug/workaround #7567

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src-docs/src/views/datagrid/basics/datagrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const RenderCellValue = ({ rowIndex, columnId, setCellProps }) => {
}, [rowIndex, columnId, setCellProps, data]);

function getFormatted() {
return data[rowIndex][columnId].formatted
return data[rowIndex][columnId]?.formatted
? data[rowIndex][columnId].formatted
: data[rowIndex][columnId];
}
Expand Down Expand Up @@ -210,6 +210,25 @@ const columns = [
isResizable: false,
actions: false,
},
{
id: 'test',
displayAsText: 'Long long long field name',
},
{
id: 'test1',
},
{
id: 'test2',
},
{
id: 'test3',
},
{
id: 'test4',
},
{
id: 'test5',
},
];

const trailingControlColumns = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,29 @@
padding-top: $euiSizeXS;
padding-bottom: $euiSizeXS;
max-height: 300px;

// Workaround for scrollbar clipping into text longer than the popover min width
@supports (scrollbar-gutter: stable) {
scrollbar-gutter: stable;
}
@supports not (scrollbar-gutter: stable) {
padding-right: 10px; // Safari :|
}
}

.euiDataGridColumnSorting__field {
@include euiInteractiveStates;
display: block;
@include euiTextTruncate;
display: flex;
align-items: center;
gap: $euiSizeS;
padding: $euiSizeXS $euiSizeS;
width: 100%;
outline-offset: -$euiFocusRingSize;

@supports not (scrollbar-gutter: stable) {
min-width: fit-content;
}
}

.euiDataGridColumnSorting__name {
Expand Down
51 changes: 19 additions & 32 deletions src/components/datagrid/controls/column_sorting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,38 +236,25 @@ export const useDataGridColumnSorting = (
sorting.onSort(nextColumns);
}}
>
<EuiFlexGroup
alignItems="center"
gutterSize="s"
component="span"
responsive={false}
>
<EuiFlexItem grow={false}>
<EuiToken
iconType={
schemaDetails(id) != null
? getDetailsForSchema(
schemaDetectors,
schema[id].columnType
).icon
: 'tokenString'
}
color={
schemaDetails(id) != null
? getDetailsForSchema(
schemaDetectors,
schema[id].columnType
).color
: undefined
}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText size="xs">
{displayValues[id]}
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
<EuiToken
iconType={
schemaDetails(id) != null
? getDetailsForSchema(
schemaDetectors,
schema[id].columnType
).icon
: 'tokenString'
}
color={
schemaDetails(id) != null
? getDetailsForSchema(
schemaDetectors,
schema[id].columnType
).color
: undefined
}
/>
<EuiText size="xs">{displayValues[id]}</EuiText>
</button>
);
}
Expand Down
Loading