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

[EuiDualRange] Fix initial incorrect thumb position #4230

Merged
merged 6 commits into from
Nov 6, 2020

Conversation

thompsongl
Copy link
Contributor

@thompsongl thompsongl commented Nov 5, 2020

Summary

Fixes a bug where EuiDualRange will position its thumbs incorrectly due to incalculable width. This occurs in situations where the range is initially rendered inside a parent element with display:none, making its width 0px;

Before:
Screen Cast 2020-11-05 at 11 17 36 AM

See the "After" at https://eui.elastic.co/pr_4230/#/forms/range-sliders#dual-range (docs update will be reverted)

The solution is to conditionally rerender the component on componentDidUpdate when a width becomes calculable.

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
  • Reverted doc change

@kibanamachine
Copy link

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

@thompsongl thompsongl requested a review from cchaos November 5, 2020 19:43
@thompsongl thompsongl marked this pull request as ready for review November 5, 2020 19:43
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.

Thanks for this fix! I tested the example in the codesandbox with the latest release (it had the issue), then test this PR and the issue is gone. 👍

Don't forget a CL ;)

Also, maybe there's someway to add a test for this? 🤷

src/components/form/range/dual_range.tsx Outdated Show resolved Hide resolved
@kibanamachine
Copy link

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

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.

3 participants