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

[EuiTable] Remove overflow/height animation causing Safari cross-browser issues #6826

Merged
merged 5 commits into from
Jun 2, 2023

Conversation

cee-chen
Copy link
Member

@cee-chen cee-chen commented Jun 2, 2023

Summary

closes #6770

Counter to our guesses/musings in the above linked thread, the issue with Safari was not the mutation observer (never fired) nor stale refs/rerenders. After adding timeouts of increasing lengths, I realized it was the animation itself that was causing Safari to return empty innerText.

The overflow: hidden on the container, in combination with the max-height, makes Safari calculate that the container's children are not visible. For not-visible children, innerText becomes '' (you can test this right now in your browser by setting any DOM node to visibility: hidden and then pasting its .innerText value in the console).

I initially played around with a couple different options to try to keep the "expanding animation". I tried the display: grid hack instead of max-height, I tried removing overflow and set an opacity instead (but didn't really like how it looked) and I briefly contemplated calculating and setting height via JS instead of CSS 😅 Finally, I decided I preferred to subtract instead of adding.

Since the animation honestly is adding no actual functionality, and the max-height CSS hack is laggy on almost every browser, I opted to not animate height whatsoever which allows the expansion to be immediate, and instead added a very light and far more performant opacity/translate Y animation. IMO, the outcome is a snappier and slightly more responsive feel.

screencap

QA

Old animation for reference: https://eui.elastic.co/v81.2.0/#/tabular-content/tables#expanding-rows

General checklist

  • Revert [REVERT ME] commit
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • A changelog entry exists and is marked appropriately

- [ ] Added or updated jest and cypress tests - Not sure there's anything we can meaningfully test here since it's such a browser-specific issue + a CSS change
- [ ] Updated the Figma library counterpart - Checking with the Figma working group to see if animations are a part of our Figma library

The overflow/height combo causes Safari to return an empty `innerText` on initial render, which is problematic for expandable content that uses our inner text or copy utils.

Since the animation honestly is adding nothing functional, and is slightly laggy, I opted for an immediate height expansion and a very slight opacity/translate Y animation for a little extra pizazz.
@cee-chen cee-chen changed the title [EuiInMemoryTable] Remove overflow/height animation causing Safari cross-browser issues [EuiTable] Remove overflow/height animation causing Safari cross-browser issues Jun 2, 2023
@kibanamachine
Copy link

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

Copy link
Contributor

@ryankeairns ryankeairns left a comment

Choose a reason for hiding this comment

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

+1 for the overall simplicity.
Minor suggestion on the animation settings.

src/components/table/_table.scss Outdated Show resolved Hide resolved
@cee-chen
Copy link
Member Author

cee-chen commented Jun 2, 2023

As a heads up, going to go ahead and revert the docs QA change since you've had a chance to test this already.

Copy link
Contributor

@ryankeairns ryankeairns left a comment

Choose a reason for hiding this comment

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

Rad. Thanks for the change!

@cee-chen cee-chen enabled auto-merge (squash) June 2, 2023 21:08
@kibanamachine
Copy link

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

@cee-chen cee-chen merged commit c777fa1 into elastic:main Jun 2, 2023
@cee-chen cee-chen deleted the 6770 branch June 2, 2023 21:44
cee-chen added a commit to elastic/kibana that referenced this pull request Jun 3, 2023
This is a backport EUI upgrade to Kibana v8.8.1 containing an
`EuiCodeBlock` bugfix requested by the Observability team:
#158644 (comment)

## [`77.1.5`](https://github.com/elastic/eui/tree/v77.1.5)

**Bug fixes**

- Fixed `EuiCodeBlock` potentially incorrectly ignoring lines ending
with a question mark when using the Copy button.
([#6794](elastic/eui#6794))
- Fixed `EuiCodeBlock` to not include line numbers when copying content
([#6824](elastic/eui#6824))
- Fixed the expanded row animation on `EuiBasicTable` causing
cross-browser Safari issues
([#6826](elastic/eui#6826))

Co-authored-by: Kibana Machine <[email protected]>
cee-chen added a commit to elastic/kibana that referenced this pull request Jun 6, 2023
## Summary

`[email protected]` ⏩ `[email protected]`

✨ Highlights:

- fixes #158644
- Adds a new Timeline icon for use within `EuiMarkdownEditor` (cc
@kqualters-elastic)
- Expandable rows used within `EuiBasicTable` and `EuiInMemoryTable` now
have a faster and snappier expand animation

___

## [`81.3.0`](https://github.com/elastic/eui/tree/v81.3.0)

- Added `timelineWithArrow` glyph to `EuiIcon`
([#6822](elastic/eui#6822))

**Bug fixes**

- Fixed `EuiCodeBlock` potentially incorrectly ignoring lines ending
with a question mark when using the Copy button.
([#6794](elastic/eui#6794))
- Fixed `EuiCodeBlock` to not include line numbers when copying content
([#6824](elastic/eui#6824))
- Fixed the expanded row animation on `EuiBasicTable` causing
cross-browser Safari issues
([#6826](elastic/eui#6826))
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.

EuiCodeBlock doesn't have a "Copy" button is Safari when rendered in EuiBasicTable's expandable row
3 participants