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

[EuiBasicTable] Fix row heights jumping when actions are disabled #6538

Merged
merged 3 commits into from
Jan 19, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -1723,6 +1723,7 @@ exports[`EuiBasicTable with multiple record actions with custom availability 1`]
</EuiTableRowCell>
<EuiTableRowCell
align="right"
css="unknown styles"
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry if this is a stupid question, but why did the snapshot update css style to unknown styles?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

looks like it's because the snapshots are using shallow and shallow probably just gave up and yolo'd the style object. eventually we'll be on RTL and ideally only snapshotting actual DOM output, so hopefully enzyme shenanigans will just go away down the road.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect! Thanks for the explanation!

hasActions={true}
key="record_actions_1_1"
showOnHover={true}
Expand Down Expand Up @@ -1784,6 +1785,7 @@ exports[`EuiBasicTable with multiple record actions with custom availability 1`]
</EuiTableRowCell>
<EuiTableRowCell
align="right"
css="unknown styles"
hasActions={true}
key="record_actions_2_1"
showOnHover={true}
Expand Down Expand Up @@ -1846,6 +1848,7 @@ exports[`EuiBasicTable with multiple record actions with custom availability 1`]
</EuiTableRowCell>
<EuiTableRowCell
align="right"
css="unknown styles"
hasActions={true}
key="record_actions_3_1"
showOnHover={true}
Expand Down Expand Up @@ -1903,6 +1906,7 @@ exports[`EuiBasicTable with multiple record actions with custom availability 1`]
</EuiTableRowCell>
<EuiTableRowCell
align="right"
css="unknown styles"
hasActions={true}
key="record_actions_4_1"
showOnHover={true}
Expand Down Expand Up @@ -3023,6 +3027,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and a single record a
</EuiTableRowCell>
<EuiTableRowCell
align="right"
css="unknown styles"
hasActions={true}
key="record_actions_1_1"
showOnHover={true}
Expand Down Expand Up @@ -3081,6 +3086,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and a single record a
</EuiTableRowCell>
<EuiTableRowCell
align="right"
css="unknown styles"
hasActions={true}
key="record_actions_2_1"
showOnHover={true}
Expand Down Expand Up @@ -3139,6 +3145,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and a single record a
</EuiTableRowCell>
<EuiTableRowCell
align="right"
css="unknown styles"
hasActions={true}
key="record_actions_3_1"
showOnHover={true}
Expand Down Expand Up @@ -3707,6 +3714,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and multiple record a
</EuiTableRowCell>
<EuiTableRowCell
align="right"
css="unknown styles"
hasActions={true}
key="record_actions_1_1"
showOnHover={true}
Expand Down Expand Up @@ -3771,6 +3779,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and multiple record a
</EuiTableRowCell>
<EuiTableRowCell
align="right"
css="unknown styles"
hasActions={true}
key="record_actions_2_1"
showOnHover={true}
Expand Down Expand Up @@ -3835,6 +3844,7 @@ exports[`EuiBasicTable with pagination, selection, sorting and multiple record a
</EuiTableRowCell>
<EuiTableRowCell
align="right"
css="unknown styles"
hasActions={true}
key="record_actions_3_1"
showOnHover={true}
Expand Down
15 changes: 15 additions & 0 deletions src/components/basic_table/basic_table.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { css } from '@emotion/react';

// Unsets the extra height caused by tooltip/popover wrappers around table action buttons
// Without this, the row height jumps whenever actions are disabled
export const euiBasicTableActionsWrapper = css`
line-height: 1;
`;
3 changes: 3 additions & 0 deletions src/components/basic_table/basic_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ import {
} from './table_types';
import { EuiTableSortMobileProps } from '../table/mobile/table_sort_mobile';

import { euiBasicTableActionsWrapper } from './basic_table.styles';

type DataTypeProfiles = Record<
EuiTableDataType,
{
Expand Down Expand Up @@ -1214,6 +1216,7 @@ export class EuiBasicTable<T = any> extends Component<
align="right"
textOnly={false}
hasActions={true}
css={euiBasicTableActionsWrapper}
>
{tools}
</EuiTableRowCell>
Expand Down
3 changes: 3 additions & 0 deletions upcoming_changelogs/6538.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Bug fixes**

- Fixed slight row height jumping in `EuiBasicTable`s when actions with tooltips became disabled