Skip to content

Commit

Permalink
[EuiTabs] Fix incorrectly wrapping tab content (elastic#7309)
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen authored Oct 24, 2023
1 parent 5f1e680 commit 79ef649
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ exports[`EuiPageHeader props page content props are passed down is rendered 1`]
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-l"
class="euiTab__content eui-textTruncate emotion-euiTab__content-l"
>
Tab 1
</span>
Expand All @@ -351,7 +351,7 @@ exports[`EuiPageHeader props page content props are passed down is rendered 1`]
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-l"
class="euiTab__content eui-textTruncate emotion-euiTab__content-l"
>
Tab 2
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ exports[`EuiPageHeaderContent props children is rendered even if content props a
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-l"
class="euiTab__content eui-textTruncate emotion-euiTab__content-l"
>
Tab 1
</span>
Expand All @@ -311,7 +311,7 @@ exports[`EuiPageHeaderContent props children is rendered even if content props a
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-l"
class="euiTab__content eui-textTruncate emotion-euiTab__content-l"
>
Tab 2
</span>
Expand Down Expand Up @@ -588,7 +588,7 @@ exports[`EuiPageHeaderContent props tabs is rendered 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-xl"
class="euiTab__content eui-textTruncate emotion-euiTab__content-xl"
>
Tab 1
</span>
Expand All @@ -600,7 +600,7 @@ exports[`EuiPageHeaderContent props tabs is rendered 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-xl"
class="euiTab__content eui-textTruncate emotion-euiTab__content-xl"
>
Tab 2
</span>
Expand Down Expand Up @@ -639,7 +639,7 @@ exports[`EuiPageHeaderContent props tabs is rendered with tabsProps 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-xl"
class="euiTab__content eui-textTruncate emotion-euiTab__content-xl"
>
Tab 1
</span>
Expand All @@ -651,7 +651,7 @@ exports[`EuiPageHeaderContent props tabs is rendered with tabsProps 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-xl"
class="euiTab__content eui-textTruncate emotion-euiTab__content-xl"
>
Tab 2
</span>
Expand Down
12 changes: 6 additions & 6 deletions src/components/tabs/__snapshots__/tab.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exports[`EuiTab props append is rendered 1`] = `
Append
</span>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
children
</span>
Expand All @@ -29,7 +29,7 @@ exports[`EuiTab props disabled and selected 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
Click Me
</span>
Expand All @@ -45,7 +45,7 @@ exports[`EuiTab props disabled is rendered 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
Click Me
</span>
Expand Down Expand Up @@ -78,7 +78,7 @@ exports[`EuiTab props isSelected is rendered 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
children
</span>
Expand All @@ -95,7 +95,7 @@ exports[`EuiTab props onClick renders button 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
children
</span>
Expand All @@ -115,7 +115,7 @@ exports[`EuiTab props prepend is rendered 1`] = `
Prepend
</span>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
children
</span>
Expand Down
10 changes: 5 additions & 5 deletions src/components/tabs/__snapshots__/tabs.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`EuiTabs props expand passes down to EuiTab children 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
Tab
</span>
Expand All @@ -32,7 +32,7 @@ exports[`EuiTabs props size l renders and passes down to EuiTab children 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-l"
class="euiTab__content eui-textTruncate emotion-euiTab__content-l"
>
Tab
</span>
Expand All @@ -52,7 +52,7 @@ exports[`EuiTabs props size m renders and passes down to EuiTab children 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
Tab
</span>
Expand All @@ -72,7 +72,7 @@ exports[`EuiTabs props size s renders and passes down to EuiTab children 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-s"
class="euiTab__content eui-textTruncate emotion-euiTab__content-s"
>
Tab
</span>
Expand All @@ -92,7 +92,7 @@ exports[`EuiTabs props size xl renders and passes down to EuiTab children 1`] =
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-xl"
class="euiTab__content eui-textTruncate emotion-euiTab__content-xl"
>
Tab
</span>
Expand Down
5 changes: 4 additions & 1 deletion src/components/tabs/tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ export const EuiTab: FunctionComponent<Props> = ({
{...(rest as ButtonHTMLAttributes<HTMLButtonElement>)}
>
{prependNode}
<span className="euiTab__content" css={cssTabContentStyles}>
<span
className="euiTab__content eui-textTruncate"
css={cssTabContentStyles}
>
{children}
</span>
{appendNode}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports[`EuiTabbedContent behavior when selected tab state isn't controlled by t
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
Elasticsearch
</span>
Expand All @@ -35,7 +35,7 @@ exports[`EuiTabbedContent behavior when selected tab state isn't controlled by t
prepend
</span>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
<strong>
Kibana
Expand Down Expand Up @@ -75,7 +75,7 @@ exports[`EuiTabbedContent behavior when uncontrolled, the selected tab should up
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
Elasticsearch
</span>
Expand All @@ -95,7 +95,7 @@ exports[`EuiTabbedContent behavior when uncontrolled, the selected tab should up
prepend
</span>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
<strong>
Kibana
Expand Down Expand Up @@ -139,7 +139,7 @@ exports[`EuiTabbedContent is rendered with required props and tabs 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
Elasticsearch
</span>
Expand All @@ -159,7 +159,7 @@ exports[`EuiTabbedContent is rendered with required props and tabs 1`] = `
prepend
</span>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
<strong>
Kibana
Expand Down Expand Up @@ -199,7 +199,7 @@ exports[`EuiTabbedContent props autoFocus initial is rendered 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
Elasticsearch
</span>
Expand All @@ -219,7 +219,7 @@ exports[`EuiTabbedContent props autoFocus initial is rendered 1`] = `
prepend
</span>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
<strong>
Kibana
Expand Down Expand Up @@ -259,7 +259,7 @@ exports[`EuiTabbedContent props autoFocus selected is rendered 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
Elasticsearch
</span>
Expand All @@ -279,7 +279,7 @@ exports[`EuiTabbedContent props autoFocus selected is rendered 1`] = `
prepend
</span>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
<strong>
Kibana
Expand Down Expand Up @@ -319,7 +319,7 @@ exports[`EuiTabbedContent props initialSelectedTab renders a selected tab 1`] =
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
Elasticsearch
</span>
Expand All @@ -339,7 +339,7 @@ exports[`EuiTabbedContent props initialSelectedTab renders a selected tab 1`] =
prepend
</span>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
<strong>
Kibana
Expand Down Expand Up @@ -379,7 +379,7 @@ exports[`EuiTabbedContent props selectedTab renders a selected tab 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
Elasticsearch
</span>
Expand All @@ -399,7 +399,7 @@ exports[`EuiTabbedContent props selectedTab renders a selected tab 1`] = `
prepend
</span>
<span
class="euiTab__content emotion-euiTab__content-m"
class="euiTab__content eui-textTruncate emotion-euiTab__content-m"
>
<strong>
Kibana
Expand Down Expand Up @@ -439,7 +439,7 @@ exports[`EuiTabbedContent props size can be small 1`] = `
type="button"
>
<span
class="euiTab__content emotion-euiTab__content-s"
class="euiTab__content eui-textTruncate emotion-euiTab__content-s"
>
Elasticsearch
</span>
Expand All @@ -459,7 +459,7 @@ exports[`EuiTabbedContent props size can be small 1`] = `
prepend
</span>
<span
class="euiTab__content emotion-euiTab__content-s"
class="euiTab__content eui-textTruncate emotion-euiTab__content-s"
>
<strong>
Kibana
Expand Down
3 changes: 3 additions & 0 deletions upcoming_changelogs/7309.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Bug fixes**

- Fixed `EuiTabs` incorrectly wrapping text when it should instead either scroll or truncate

0 comments on commit 79ef649

Please sign in to comment.