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

Prevent EuiToolTip from destroying & recreating its children *every* render #4174

Closed

Conversation

chandlerprall
Copy link
Contributor

Summary

As reported over slack, if an EuiComboBox is wrapped by an EuiToolTip, the virtualized list scrolling resets:

oct-22-2020_17-23-20

This is caused by the tooltip cloning its children every render pass, causing React to unmount the previous children and remount the "new" one, which resets the scroll position. The root of that root is the mouseover/blur event handling within tooltip doesn't understand portals (which the options list is).

My proposal here caches the result from cloning of children until it changes again - so any re-rendering of the parent component will re-trigger this same issue, but it prevents changes made to tooltip's internal state from destroying everything.

A side effect is that the aria-describedby value is present at all times, which may or may not anger @myasonik and will trigger a lot of snapshot updates (including the failing CI on this PR, I left the snapshots unchanged to help show the difference).

I am very open to other ideas.

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs
  • Added documentation
  • Checked Code Sandbox works for the any docs examples
  • Added or updated jest tests
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link

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

@chandlerprall
Copy link
Contributor Author

this was fixed avoided downstream by moving the tooltip into a callout elastic/kibana#81585

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.

2 participants