Skip to content

Commit

Permalink
Fix UI breaks on providing long search keyword in 'Search Box' (elast…
Browse files Browse the repository at this point in the history
…ic#101385)

Allowing words to wrap on whitespaces fixes the issue.
I also added word-break for allowing long words to wrap.
  • Loading branch information
machadoum committed Jun 7, 2021
1 parent 26badfc commit 065e378
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { EuiPanel, EuiBasicTable } from '@elastic/eui';
import React, { useCallback, useMemo, useRef } from 'react';
import { FormattedMessage } from '@kbn/i18n/react';

import styled from 'styled-components';
import { TimelineType, TimelineStatus } from '../../../../common/types/timeline';
import { ImportDataModal } from '../../../common/components/import_data_modal';
import {
Expand All @@ -30,6 +31,11 @@ import * as i18n from './translations';
import { OPEN_TIMELINE_CLASS_NAME } from './helpers';
import { OpenTimelineProps, OpenTimelineResult, ActionTimelineToShow } from './types';

const QueryText = styled.span`
white-space: normal;
word-break: break-word;
`;

export const OpenTimeline = React.memo<OpenTimelineProps>(
({
deleteTimelines,
Expand Down Expand Up @@ -86,9 +92,9 @@ export const OpenTimeline = React.memo<OpenTimelineProps>(
values={{
totalSearchResultsCount,
with: (
<span data-test-subj="selectable-query-text">
<QueryText data-test-subj="selectable-query-text">
{query.trim().length ? `${i18n.WITH} "${query.trim()}"` : ''}
</span>
</QueryText>
),
}}
/>
Expand All @@ -104,9 +110,9 @@ export const OpenTimeline = React.memo<OpenTimelineProps>(
values={{
totalSearchResultsCount,
with: (
<span data-test-subj="selectable-query-text">
<QueryText data-test-subj="selectable-query-text">
{query.trim().length ? `${i18n.WITH} "${query.trim()}"` : ''}
</span>
</QueryText>
),
}}
/>
Expand Down

0 comments on commit 065e378

Please sign in to comment.