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

[EuiImage] Fix empty figcaptions and non-centered EuiEmptyPrompt images #6081

Merged
merged 5 commits into from
Jul 27, 2022

Conversation

cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Jul 27, 2022

Summary

closes #6080

Checklist

  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • A changelog entry exists and is marked appropriately

- [ ] Checked in both light and dark modes
- [ ] Props have proper autodocs and playground toggles
- [ ] Added documentation
- [ ] Checked Code Sandbox works for any docs examples
- [ ] Added or updated jest and cypress tests
- [ ] Checked for breaking changes and labeled appropriately
- [ ] Checked for accessibility including keyboard-only and screenreader modes
- [ ] Updated the Figma library counterpart

cee-chen added 2 commits July 27, 2022 10:05
- max width is causing the figure to not be centered - we should set horizontal margins to `auto` if EuiEmptyPrompt is setting a custom max-width
@cee-chen cee-chen requested review from cchaos and elizabetdev July 27, 2022 17:22
@cee-chen cee-chen marked this pull request as ready for review July 27, 2022 17:25
@@ -12,6 +12,7 @@
> * {
flex-shrink: 1;
max-width: convertToRem(360px);
margin-inline: auto;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, yes this fixes empty prompt's specifically, but consumers will still come across this issue in their own applications and not know to have to do this.

I, personally, think we're optimizing for a much lesser used / occurring issue (stacked floats) instead of the more common use case which is centered images via text-align.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair, but I think it depends on what we want to consider the default display type of EuiImage 🤔

  • If it's inline/inline-block (and the margin issues that come with it), sure.
  • But if we consider the default display to be block (or similar, e.g. flex, table), then this fix is more valid, because EuiEmptyPrompt is setting a custom max-width, and this non-centering behavior would be the same as well for display: block.

It's not super straightforward here as well as the default display value of the img tag is inline (which means it's affected by text-align), but the default display of the figure tag (which is what EuiImage uses) is block (which means it's not affected by text-align).

If we want EuiImage to behave like closer to a default img tag and the figure tag is just a semantic afterthought, then OK, I just want to make sure that's a conscious display/layout flow choice that we're making.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After chatting about this briefly in sync, we've determined we do want EuiImage to behave closer to an img tag and not the figure tag, so I'll go ahead and revert the table change!

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6081/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6081/

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The empty prompt's are fixed and the extra block spacing doesn't bother me.

Screen Shot 2022-07-27 at 15 10 48 PM

upcoming_changelogs/6081.md Outdated Show resolved Hide resolved
@cee-chen
Copy link
Contributor Author

cee-chen commented Jul 27, 2022

Going to merge without re-running CI as latest commit was just changelog change and I want to do a backport release to get this fix into the next Kibana upgrade.

@cee-chen cee-chen merged commit 94c067d into elastic:main Jul 27, 2022
@cee-chen cee-chen deleted the image-fixes branch July 27, 2022 19:35
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6081/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EuiImage] Using display: table breaks fullWidth centering
3 participants