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

[EuiInlineEdit] Add title to Read Mode Button #6966

Merged
merged 7 commits into from
Jul 20, 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 @@ -739,6 +739,7 @@ exports[`EuiInlineEditForm read mode isReadOnly 1`] = `
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-m-empty-disabled-flush-both-isDisabled-euiInlineEditReadMode-isReadOnly"
data-test-subj="euiInlineReadModeButton"
disabled=""
title="Hello World!"
type="button"
>
<span
Expand Down Expand Up @@ -766,6 +767,7 @@ exports[`EuiInlineEditForm read mode placeholder 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-m-empty-text-flush-both-euiInlineEditReadMode-hasPlaceholder"
data-test-subj="euiInlineReadModeButton"
title="This is a placeholder."
type="button"
>
<span
Expand Down Expand Up @@ -799,6 +801,7 @@ exports[`EuiInlineEditForm read mode readModeProps 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-m-empty-primary-flush-both-euiInlineEditReadMode"
data-test-subj="euiInlineReadModeButton"
title="Hello World!"
type="button"
>
<span
Expand Down Expand Up @@ -832,6 +835,7 @@ exports[`EuiInlineEditForm read mode renders 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-m-empty-text-flush-both-euiInlineEditReadMode"
data-test-subj="euiInlineReadModeButton"
title="Hello World!"
type="button"
>
<span
Expand Down Expand Up @@ -865,6 +869,7 @@ exports[`EuiInlineEditForm read mode sizes 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-s-empty-text-flush-both-euiInlineEditReadMode"
data-test-subj="euiInlineReadModeButton"
title="Hello World!"
type="button"
>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exports[`EuiInlineEditText isReadOnly 1`] = `
data-test-subj="euiInlineReadModeButton"
disabled=""
role="paragraph"
title="Hello World!"
type="button"
>
<span
Expand Down Expand Up @@ -41,6 +42,7 @@ exports[`EuiInlineEditText renders 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-m-empty-text-flush-both-euiInlineEditReadMode"
data-test-subj="euiInlineReadModeButton"
title="Hello World!"
type="button"
>
<span
Expand Down Expand Up @@ -78,6 +80,7 @@ exports[`EuiInlineEditText text sizes renders m 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-m-empty-text-flush-both-euiInlineEditReadMode"
data-test-subj="euiInlineReadModeButton"
title="Hello World!"
type="button"
>
<span
Expand Down Expand Up @@ -115,6 +118,7 @@ exports[`EuiInlineEditText text sizes renders s 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-s-empty-text-flush-both-euiInlineEditReadMode"
data-test-subj="euiInlineReadModeButton"
title="Hello World!"
type="button"
>
<span
Expand Down Expand Up @@ -152,6 +156,7 @@ exports[`EuiInlineEditText text sizes renders xs 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-s-empty-text-flush-both-euiInlineEditReadMode"
data-test-subj="euiInlineReadModeButton"
title="Hello World!"
type="button"
>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ exports[`EuiInlineEditTitle isReadOnly 1`] = `
data-test-subj="euiInlineReadModeButton"
disabled=""
role="heading"
title="Hello World!"
type="button"
>
<span
Expand Down Expand Up @@ -43,6 +44,7 @@ exports[`EuiInlineEditTitle renders 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-m-empty-text-flush-both-euiInlineEditReadMode"
data-test-subj="euiInlineReadModeButton"
title="Hello World!"
type="button"
>
<span
Expand Down Expand Up @@ -80,6 +82,7 @@ exports[`EuiInlineEditTitle title sizes renders size l 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-m-empty-text-flush-both-euiInlineEditReadMode"
data-test-subj="euiInlineReadModeButton"
title="Hello World!"
type="button"
>
<span
Expand Down Expand Up @@ -117,6 +120,7 @@ exports[`EuiInlineEditTitle title sizes renders size m 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-m-empty-text-flush-both-euiInlineEditReadMode"
data-test-subj="euiInlineReadModeButton"
title="Hello World!"
type="button"
>
<span
Expand Down Expand Up @@ -154,6 +158,7 @@ exports[`EuiInlineEditTitle title sizes renders size s 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-s-empty-text-flush-both-euiInlineEditReadMode"
data-test-subj="euiInlineReadModeButton"
title="Hello World!"
type="button"
>
<span
Expand Down Expand Up @@ -191,6 +196,7 @@ exports[`EuiInlineEditTitle title sizes renders size xs 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-s-empty-text-flush-both-euiInlineEditReadMode"
data-test-subj="euiInlineReadModeButton"
title="Hello World!"
type="button"
>
<span
Expand Down Expand Up @@ -228,6 +234,7 @@ exports[`EuiInlineEditTitle title sizes renders size xxs 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-s-empty-text-flush-both-euiInlineEditReadMode"
data-test-subj="euiInlineReadModeButton"
title="Hello World!"
type="button"
>
<span
Expand Down Expand Up @@ -265,6 +272,7 @@ exports[`EuiInlineEditTitle title sizes renders size xxxs 1`] = `
aria-describedby="inlineEdit_generated-id"
class="euiButtonEmpty emotion-euiButtonDisplay-euiButtonEmpty-s-empty-text-flush-both-euiInlineEditReadMode"
data-test-subj="euiInlineReadModeButton"
title="Hello World!"
type="button"
>
<span
Expand Down
11 changes: 10 additions & 1 deletion src/components/inline_edit/inline_edit_form.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('EuiInlineEditForm', () => {
});

test('placeholder', () => {
const { container, getByText } = render(
const { container, getByText, getByTitle } = render(
<EuiInlineEditForm
{...commonInlineEditFormProps}
defaultValue=""
Expand All @@ -87,6 +87,15 @@ describe('EuiInlineEditForm', () => {

expect(container.firstChild).toMatchSnapshot();
expect(getByText('This is a placeholder.')).toBeTruthy();
expect(getByTitle('This is a placeholder.')).toBeTruthy();
});

it('renders the read mode value in a title tooltip', () => {
const { getByTitle } = render(
<EuiInlineEditForm {...commonInlineEditFormProps} />
);

expect(getByTitle('Hello World!')).toBeTruthy();
});
});

Expand Down
1 change: 1 addition & 0 deletions src/components/inline_edit/inline_edit_form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ export const EuiInlineEditForm: FunctionComponent<EuiInlineEditFormProps> = ({
data-test-subj="euiInlineReadModeButton"
disabled={isReadOnly}
css={readModeCssStyles}
title={readModeValue || placeholder}
{...readModeProps}
buttonRef={setReadModeRefs}
aria-describedby={classNames(
Expand Down
1 change: 1 addition & 0 deletions upcoming_changelogs/6966.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Updated `EuiInlineEdit`'s read mode button to include a title tooltip, increasing readability of truncated text