Skip to content

Commit

Permalink
Fix responsive edge case
Browse files Browse the repository at this point in the history
- where separators can disappear on small screens/containers
  • Loading branch information
cee-chen committed Nov 20, 2023
1 parent e8b9a5f commit a9cf1e4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`EuiBreadcrumbContent renders breadcrumbs with \`popoverContent\` with p
<body>
<div>
<div
class="euiPopover euiPopover-isOpen emotion-euiPopover-inline-block"
class="euiPopover euiPopover-isOpen emotion-euiPopover-inline-block-euiBreadcrumb__popoverWrapper"
data-test-subj="popover"
>
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ exports[`EuiBreadcrumbs is rendered 1`] = `
data-test-subj="euiBreadcrumb"
>
<div
class="euiPopover emotion-euiPopover-inline-block"
class="euiPopover emotion-euiPopover-inline-block-euiBreadcrumb__popoverWrapper"
>
<button
class="euiLink emotion-euiLink-subdued-euiBreadcrumb__popoverButton"
Expand Down Expand Up @@ -143,7 +143,7 @@ exports[`EuiBreadcrumbs is rendered with final item as link 1`] = `
data-test-subj="euiBreadcrumb"
>
<div
class="euiPopover emotion-euiPopover-inline-block"
class="euiPopover emotion-euiPopover-inline-block-euiBreadcrumb__popoverWrapper"
>
<button
class="euiLink emotion-euiLink-subdued-euiBreadcrumb__popoverButton"
Expand Down Expand Up @@ -329,7 +329,7 @@ exports[`EuiBreadcrumbs props max renders 1 item 1`] = `
data-test-subj="euiBreadcrumb"
>
<div
class="euiPopover emotion-euiPopover-inline-block"
class="euiPopover emotion-euiPopover-inline-block-euiBreadcrumb__popoverWrapper"
>
<button
class="euiLink emotion-euiLink-subdued-euiBreadcrumb__popoverButton"
Expand Down Expand Up @@ -514,7 +514,7 @@ exports[`EuiBreadcrumbs props responsive is rendered 1`] = `
data-test-subj="euiBreadcrumb"
>
<div
class="euiPopover emotion-euiPopover-inline-block"
class="euiPopover emotion-euiPopover-inline-block-euiBreadcrumb__popoverWrapper"
>
<button
class="euiLink emotion-euiLink-subdued-euiBreadcrumb__popoverButton"
Expand Down Expand Up @@ -617,7 +617,7 @@ exports[`EuiBreadcrumbs props responsive is rendered as false 1`] = `
data-test-subj="euiBreadcrumb"
>
<div
class="euiPopover emotion-euiPopover-inline-block"
class="euiPopover emotion-euiPopover-inline-block-euiBreadcrumb__popoverWrapper"
>
<button
class="euiLink emotion-euiLink-subdued-euiBreadcrumb__popoverButton"
Expand Down Expand Up @@ -695,7 +695,7 @@ exports[`EuiBreadcrumbs props responsive is rendered with custom breakpoints 1`]
data-test-subj="euiBreadcrumb"
>
<div
class="euiPopover emotion-euiPopover-inline-block"
class="euiPopover emotion-euiPopover-inline-block-euiBreadcrumb__popoverWrapper"
>
<button
class="euiLink emotion-euiLink-subdued-euiBreadcrumb__popoverButton"
Expand Down
7 changes: 7 additions & 0 deletions src/components/breadcrumbs/breadcrumb.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ export const euiBreadcrumbContentStyles = (euiThemeContext: UseEuiTheme) => {
align-items: center;
gap: ${euiTheme.size.xs};
`,
euiBreadcrumb__popoverWrapper: css`
/* At small container widths, the popover anchor needs to leave room for the breadcrumb separator,
which is weird to get an exact width for because it's transformed at an angle */
max-inline-size: calc(
100% - ${mathWithUnits(euiTheme.size.base, (x) => x + 1)}
);
`,

// Types
page: css`
Expand Down
1 change: 1 addition & 0 deletions src/components/breadcrumbs/breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export const EuiBreadcrumbContent: FunctionComponent<
{...popoverProps}
isOpen={isPopoverOpen}
closePopover={() => setIsPopoverOpen(false)}
css={!isLastBreadcrumb && styles.euiBreadcrumb__popoverWrapper}
button={
<EuiLink
{...baseProps}
Expand Down

0 comments on commit a9cf1e4

Please sign in to comment.