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

[EuiAccordion] Allow external control #3614

Merged
merged 7 commits into from
Jun 16, 2020

Conversation

thompsongl
Copy link
Contributor

@thompsongl thompsongl commented Jun 15, 2020

Summary

Resolves #3594 by allowing forceState and onToggle to work together as an external state value and update function pair.

When forceState is in use onToggle will be called with a boolean reflecting the current open/closed state. This might be slightly confusing as standard onToggle is called with a boolean reflecting the new open/closed state after click.

Checklist

- [ ] Check against all themes for compatibility in both light and dark modes
- [ ] Checked in mobile
- [ ] Checked in IE11 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_3614/

@chandlerprall
Copy link
Contributor

Changes look good, though thinking about

onToggle will be called with a boolean reflecting the current open/closed state. This might be slightly confusing

Thoughts on calling onToggle with the user-initiated state value instead?

@thompsongl
Copy link
Contributor Author

Thoughts on calling onToggle with the user-initiated state value instead?

I could definitely go either way on this.
My read is that the consumer won't be attempting a bunch of logic around this value and will just update state accordingly, so perhaps passing the state expected by the user after click makes more sense.

@chandlerprall
Copy link
Contributor

so perhaps passing the state expected by the user after click makes more sense.

I think so; let's go that way, then this is good to merge

@kibanamachine
Copy link

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

@chandlerprall
Copy link
Contributor

Looks like the accordion_forceState.js example wasn't updated and expects the inverse value in onToggle

@kibanamachine
Copy link

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

@chandlerprall
Copy link
Contributor

PUPPETEER_SKIP_CHROMIUM_DOWNLOAD

jenkins test this

Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

Changes LGTM! Tested in the PR's docs

@kibanamachine
Copy link

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

@thompsongl thompsongl merged commit 2c47d9c into elastic:master Jun 16, 2020
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.

EuiAccordion - allow user to control open state from the outside
3 participants