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

[EuiTable] Added title to headers in case of truncation #3094

Merged
merged 11 commits into from
Mar 19, 2020
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added title to headers of `EuiTable` when truncated ([#3094](https://github.com/elastic/eui/pull/3094))
anishagg17 marked this conversation as resolved.
Show resolved Hide resolved
- Added `href` prop to `EuiBadge` ([#3009](https://github.com/elastic/eui/pull/3009))
- Added props descriptions for `EuiComboBox` ([#3007](https://github.com/elastic/eui/pull/3007))
- Exported `dateFormatAliases` as a part of the public API ([#3043](https://github.com/elastic/eui/pull/3043))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,14 @@ exports[`EuiInMemoryTable behavior pagination 1`] = `
<div
className="euiTableCellContent"
>
<span
className="euiTableCellContent__text"
>
Name
</span>
<EuiInnerText>
<span
className="euiTableCellContent__text"
title="Name"
>
Name
</span>
</EuiInnerText>
</div>
</th>
</EuiTableHeaderCell>
Expand Down
10 changes: 9 additions & 1 deletion src/components/table/table_header_button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { ButtonHTMLAttributes, FunctionComponent } from 'react';
import classNames from 'classnames';
import { CommonProps } from '../common';
import { EuiInnerText } from '../inner_text';

import { IconType, EuiIcon } from '../icon';

Expand Down Expand Up @@ -33,7 +34,14 @@ export const EuiTableHeaderButton: FunctionComponent<Props> = ({

return (
<button type="button" className={classes} {...rest}>
<span>{children}</span>
<EuiInnerText>
{(ref, innerText) => (
<span title={innerText} ref={ref}>
{children}
</span>
)}
</EuiInnerText>

{buttonIcon}
</button>
);
Expand Down
24 changes: 22 additions & 2 deletions src/components/table/table_header_cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { EuiScreenReaderOnly } from '../accessibility';
import { CommonProps, NoArgCallback } from '../common';
import { EuiIcon } from '../icon';
import { resolveWidthAsStyle } from './utils';
import { EuiInnerText } from '../inner_text';

import {
HorizontalAlignment,
Expand Down Expand Up @@ -130,7 +131,17 @@ export const EuiTableHeaderCell: FunctionComponent<Props> = ({
onClick={onSort}
data-test-subj="tableHeaderSortButton">
<span className={contentClasses}>
<span className="euiTableCellContent__text">{children}</span>
<EuiInnerText>
{(ref, innerText) => (
<span
title={innerText}
anishagg17 marked this conversation as resolved.
Show resolved Hide resolved
ref={ref}
className="euiTableCellContent__text">
{children}
</span>
)}
</EuiInnerText>

{isSorted && (
<EuiIcon
className="euiTableSortIcon"
Expand All @@ -156,7 +167,16 @@ export const EuiTableHeaderCell: FunctionComponent<Props> = ({
style={styleObj}
{...rest}>
<div className={contentClasses}>
<span className="euiTableCellContent__text">{children}</span>
<EuiInnerText>
{(ref, innerText) => (
<span
title={innerText}
ref={ref}
className="euiTableCellContent__text">
{children}
</span>
)}
</EuiInnerText>
</div>
</CellComponent>
);
Expand Down