Conversation
| // Kibana's Ace Editor uses this function, can't remove yet | ||
| // https://github.com/elastic/kibana/blob/main/src/core/public/styles/_ace_overrides.scss | ||
| // As well as deprecation notices | ||
| // https://github.com/elastic/kibana/blob/main/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/_step_progress.scss | ||
| @function euiCallOutColor($type: 'primary', $returnBackgroundOrForeground: 'background') { |
There was a problem hiding this comment.
I don't know if we want to leave comments specifically pointing to Kibana files, but figured since I found them anyway?
| return { | ||
| euiCallOutHeader: css` | ||
| font-weight: ${euiTheme.font.weight.medium}; | ||
| margin-bottom: 0 !important; // In case it's nested inside EuiText |
There was a problem hiding this comment.
Specificity shot me on this one
There was a problem hiding this comment.
Sometimes an !important tag is what's needed.
|
|
||
| const classes = classNames( | ||
| 'euiCallOut', | ||
| colorToClassNameMap[color], |
There was a problem hiding this comment.
Unfortunately I couldn't get rid of the color class name because a lot of tests were specifically pointing to these
src/components/call_out/call_out.tsx
Outdated
| } | ||
|
|
||
| const H: any = heading ? `${heading}` : 'span'; | ||
| const H: any = heading ? `${heading}` : 'p'; |
There was a problem hiding this comment.
I changed the default heading here to p because it felt odd to not have text in something text-like especially if it's then followed by more text.
There was a problem hiding this comment.
Instead of doing this, you can just pick heading = 'p', as the default prop. The same way we're doing with color = 'primary':
eui/src/components/call_out/call_out.tsx
Lines 46 to 57 in f209dd4
| <H className="euiCallOutHeader__title">{title}</H> | ||
| </div> | ||
| <EuiTitle size={size === 's' ? 'xxs' : 'xs'} css={cssHeaderStyles}> | ||
| <H className="euiCallOutHeader__title"> |
There was a problem hiding this comment.
This className too is targeted a lot in tests
src/components/call_out/call_out.tsx
Outdated
| // @ts-expect-error Help with forward ref | ||
| ref={ref} |
There was a problem hiding this comment.
Fixed in 6a85444
EuiPanel takes panelRef instead of ref
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5870/ |
elizabetdev
left a comment
There was a problem hiding this comment.
Thanks, @cchaos. The icon inline with the heading text looks much better! 😍
Tested in Chrome, Safari, Edge, and Firefox. LGTM! 🎉
src/components/call_out/call_out.tsx
Outdated
| } | ||
|
|
||
| const H: any = heading ? `${heading}` : 'span'; | ||
| const H: any = heading ? `${heading}` : 'p'; |
There was a problem hiding this comment.
Instead of doing this, you can just pick heading = 'p', as the default prop. The same way we're doing with color = 'primary':
eui/src/components/call_out/call_out.tsx
Lines 46 to 57 in f209dd4
src/components/call_out/call_out.tsx
Outdated
| // @ts-expect-error Help with forward ref | ||
| ref={ref} |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5870/ |
|
Flakey? Jenkins, test this |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5870/ |
1Copenut
left a comment
There was a problem hiding this comment.
LGTM! One suggested change with a case for why, but I'm okay leaving as is.
| return { | ||
| euiCallOutHeader: css` | ||
| font-weight: ${euiTheme.font.weight.medium}; | ||
| margin-bottom: 0 !important; // In case it's nested inside EuiText |
There was a problem hiding this comment.
Sometimes an !important tag is what's needed.
| children, | ||
| className, | ||
| heading, | ||
| heading = 'p', |
There was a problem hiding this comment.
What do you think about defaulting this heading to h2 ? If it won't cause a style break, I'd like to consider it for accessibility. Screen reader users often navigate pages asynchronously using headings and it'd be a nice addition. If p is the best default, I'm good leaving as is.
There was a problem hiding this comment.
The problem is context. We have no idea where this will be placed (what if it came after an h3?). They're all over the place and my guess that could be a big breaking change in a11y tests.
There was a problem hiding this comment.
But I agree p is not as good here and a heading. Can you make an issue to address this specifically. I don't want to make that call in a conversion PR.
There was a problem hiding this comment.
Strong point about context. You're right, we don't know where it'll be used and we do not want to accidentally start nesting H2s inside H3, H4, etc. That'd be worse than no heading. I'll add a ticket to address this. Maybe as simple as an ahem, callout in our docs page that the consuming app should look at heading structure and use that as a guide for the prop value.
There was a problem hiding this comment.
++ That and/or we can eventually make that property required by the consumer. That way they always have to make the consideration.
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5870/ |

Summary
Converts EuiCallOut to remove custom styles but instead directly use EuiPanel as the parent component, and EuiTitle for the heading. I'll make in-code comments about the rest of the changes.
Also fixes callout portion of #5111 by moving the icon inline with the heading text and just letting the text wrap:
Also increased the default contrast ratio to
4.85This is a very slight change mainly to fix our primary text which was not getting calculated high enough to be able to display on top of the primary panel background:

So instead of trying to do specific calculations for callout, I opted for just increasing the minimum contrast for all text calculations since we'll likely see more and more uses of theses shaded backgrounds. The visible changes are very minimal and have most effect on the primary color:
The good news is that now we can be pretty certain that if anyone uses these background colors and the text colors together, they'll pretty much all work.
Checklist
[ ] Props have proper autodocs and playground toggles[ ] Checked Code Sandbox works for any docs examples[ ] Checked for breaking changes and labeled appropriatelyThings to look out for when moving styles
QA