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

Allow EuiAccordion state to be controlled from outside #3240

Merged
merged 23 commits into from
Apr 10, 2020

Conversation

anishagg17
Copy link
Contributor

@anishagg17 anishagg17 commented Apr 3, 2020

Summary

Fixes: #2130

Sceenshot

Hnet com-image

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 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

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@anishagg17 anishagg17 changed the title Allow state to be controlled from outside Allow EuiAccordion state to be controlled from outside Apr 3, 2020
@cchaos
Copy link
Contributor

cchaos commented Apr 3, 2020

Thanks @anishagg17 for this start. I don't think this prop quite fits the ask from the issue. The issue isn't asking to force a consistent state (here, closed), but to allow the toggling of the accordion to happen via an outside trigger.

So think of a button that exist outside of the accordion that will either toggle the current state of the accordion or try to open it no matter the state, or close it no matter the state. More similar to a high-order-component (one that completely handles the state of a child component).

@anishagg17
Copy link
Contributor Author

anishagg17 commented Apr 3, 2020

OKay would make changes accordingly, can you suggest prop name?

@anishagg17
Copy link
Contributor Author

now it works as

Hnet com-image (2)

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.

When given this prop, the interaction is very hard to understand:

sporadic accordion

I think onToggle should not update the state when it is being forced, i.e. clicking on a forced-open or forced-closed accordion is a no-op. The onToggle prop should still be called

src/components/accordion/accordion.tsx Outdated Show resolved Hide resolved
src-docs/src/views/accordion/accordion_forceClose.js Outdated Show resolved Hide resolved
@anishagg17
Copy link
Contributor Author

All changes have been made

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.

Small copy changes, otherwise this looks good!

CHANGELOG.md Outdated Show resolved Hide resolved
src-docs/src/views/accordion/accordion_example.js Outdated Show resolved Hide resolved
src-docs/src/views/accordion/accordion_example.js Outdated Show resolved Hide resolved
anishagg17 and others added 4 commits April 8, 2020 01:12
Co-Authored-By: Chandler Prall <chandler.prall@gmail.com>
Co-Authored-By: Chandler Prall <chandler.prall@gmail.com>
Co-Authored-By: Chandler Prall <chandler.prall@gmail.com>
@chandlerprall
Copy link
Contributor

jenkins test this

@kibanamachine
Copy link

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

@chandlerprall
Copy link
Contributor

jenkins test this

@kibanamachine
Copy link

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

@chandlerprall
Copy link
Contributor

Looks like something in the example got disconnected - I'd guess its the accessibility fix. Both buttons toggle the option on/off and neither highlight.

https://eui.elastic.co/pr_3240/#/layout/accordion

disconnected example

@anishagg17
Copy link
Contributor Author

I have resolved the issue

@chandlerprall
Copy link
Contributor

jenkins test this

@kibanamachine
Copy link

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

@chandlerprall chandlerprall merged commit 60f885f into elastic:master Apr 10, 2020
@chandlerprall
Copy link
Contributor

thanks again @anishagg17 !

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: possibility to control opened/closed state
4 participants