pf-accordion component - #30
Conversation
|
@Agathver awesome job with this! I am really impressed 😸 I tested cross browser and it worked as expected. One functional thing I noticed. When one item is collapsed and we attempt to collapse a second item, the first item should close (like our test page here). I would say next, can you add multiple accordions to your test page and just show that Feel free to get going with tests when you have time! Once tests are done, we can also just double check the generated Fantastic job with this @Agathver ! I really appreciate this!!! |
I've fixed it in my latest commit. However, I couldn't get the test case for this behavior done. pf-accordion, in its current form doesn't work well with JS generated content. |
|
I've fixed all the issues and implemented all the behavior of the PF accordion component.
|
priley86
left a comment
There was a problem hiding this comment.
Hey @Agathver, again great job with this!
As another step, can you please make the paths relative and test out building this branch in your fork? I left instructions on this in #38 . Let me know if you have any troubles...
Just want to ensure this looks properly and paths are correct once merged...
| <html> | ||
| <head> | ||
| <title>pf-accordion example</title> | ||
| <link rel="stylesheet" href="/dist/css/patternfly.css"> |
There was a problem hiding this comment.
can we make all paths relative? i.e.../../dist/css/patternfly.css
This will enable sharing this page in your fork. Check other components for examples...
|
Hey @Agathver - your accordion here is looking good! (just sharing this link for other reviewers) I think a found a way to break it though ;) Try these steps:
Expected behavior here would be for Collapsible Group Item #1 to collapse again. Can you reproduce it? |
|
also - please squash commits when you get a chance 😸 |
|
@Agathver yes, it is expanded initially (which is fine). however, once clicked, it becomes decollapsed (expected), and once clicked again, it is frozen (which is unexpected). Can you try this? actually it seems all accordion items have same behavior...they will only expand once... |
|
hey @Agathver , one other thing I'd like to test w/ this is handling content changes (most commonly a framework will render nested bindings inside of your CE's template). What's important to note about this is framework lifecycle exists outside of CE lifecycle, so one way simple way to handle this is to expose a |
|
@priley86 Here, we do not modify the user supplied DOM in any way, so frameworks should have no issues. I'll test them with Angular (1&2) and React at a later date after I finish my crash course on React this weekend. Adding panels dynamically also should work fine. Only the child of
For some reason, the |
|
great! thanks so much @Agathver. It's also great to hear you are learning more about Angular & React! This will not only help w/ Web Component development, but will enable you to build more apps and ensure the web components work well everywhere (our main goal!). I think familiarity w/ these frameworks will help your career regardless though. Also thanks for looking at this issue I noted...this PR is looking pretty close after that. Are you able to update the events after our new event naming convention? Keep up the great work 💯 😺 |
|
I am facing this strange issue. The collapse and expand work fine when a debugger is attached, but without the debgger, it doesn't. |
|
Hi @priley86 the panel collapsing issue should be fixed. Please check and let me know. When everything is fine, I'll squash all the commits. |
|
awesome @Agathver, this looks great! I confirmed too that this bug is fixed in your test page. Great job! do you mind updating the event names based on our new convention? ( also, would love to see an Angular or React plunker on this just to be sure it works out...but it looks fine to me :) Let me know if I can help any further. |
| if (this._target._initialized) { | ||
| this._initializeToggle(); | ||
| } else { | ||
| this._target.addEventListener('pf-accordion-initialized', () => { |
| this._toggle.classList.add('collapsed'); | ||
| this._toggle.setAttribute('aria-expanded', 'false'); | ||
| } | ||
| this._target.addEventListener('pf-accordion-expanding', () => { |
| this._toggle.classList.remove('collapsed'); | ||
| this._toggle.setAttribute('aria-expanded', 'true'); | ||
| }); | ||
| this._target.addEventListener('pf-accordion-collapsing', () => { |
|
@priley86 I have updated the events to the new convention. |
|
@Agathver awesome! this looks amazing. I think we are almost there. Let's just test this out now in Angular/React...Do you have a plnkr up we can use? Eventually it will be nice to add examples to our ng2/React repos, but I think we can safely merge this PR beforehand if we just confirm it works... Thanks so much!!! |
fda7ee8 to
831bc76
Compare
ae6adbe to
bc9a032
Compare
|
|
|
@Agathver the demos look great! I think this adequately demonstrates the WC and its functionality cross framework. Small note about the React demo, we can add the I'll await other reviewers to chime in and see if we can't improve anything else... |
|
any more thoughts @dlabrecq @bleathem @cdcabrera ? |
|
Since we have moved to CE v1 this PR needs to be updated too. |
|
Looks like travis won't let code with mutation observers to pass #45 |
|
Thanks for reporting this @Agathver (and thanks very much for upgrading pf-accordion to v1)! If we have to hold off from testing Mutation Observer w/ Travis/ Headless Chrome for the time being, I think that's OK. Headless Chrome definitely seems to be a better option than Phantom. Any idea if there is an issue opened w/ the Travis team we can link to? This is cutting edge research so thanks so much for looking into it 👍 |
|
@priley86 It really looks something else is happening, like callbacks being called in async manner or the connectedCallback not being called at all! I even tried installing Chrome 58 in travis and it still fails. Here is my approach: https://github.com/Agathver/patternfly-webcomponents/blob/travis-test/.travis.yml While the same version works in local |
|
@Agathver , Headless Chrome is shipping in Chrome 59+. |
|
@dabeng Headless landed in Chrome/Chromium 58 for Linux, 59 for macOS abd others. However now that Chrome 59 is out, we still should be able to get it running. The travis log clearly shows that, the script errors out while executing a test that needs |
| /** | ||
| * Called when an instance was inserted into the document | ||
| */ | ||
| connctedCallback() { |
There was a problem hiding this comment.
It should be connectedCallback().
| * Called when the element is removed from the DOM | ||
| */ | ||
| disconnectedCallback() { | ||
| this._observer.disconnect(); |
There was a problem hiding this comment.
this._observer will be undefined on pf-accordion-heading being removed. So just remove this sentence.
There was a problem hiding this comment.
I moved the initialization of MutationObserver to constructors, hence it should not be undefined. However, as I understood the v1 spec, the connectedCallback should be executed before disconnectedCallback
| * Called when the element is removed from the DOM | ||
| */ | ||
| disconnectedCallback() { | ||
| this._observer.disconnect(); |
There was a problem hiding this comment.
this._observer will be undefined on pf-accordion being removed. So just remove this sentence.
|
Hi @Agathver , I just put forward three recommendations. I believe you can get Travis working again If you try them out. |
|
@priley86 , Hi patrick, maybe you have the appropriate right to modify the amitosh's PR. I have found some snippets which should be corrected. |
|
hey @dabeng - i think it is fine to branch @Agathver's branch and push a new one if you'd like. You can pull request into his branch or start a new PR that we can reference in this PR (no issue at all w/ ongoing PRs here if you want to help out). @Agathver, thanks a lot for helping us get this far w/ pf-accordion and @dabeng thanks for the reviews! |
131bd99 to
f26173a
Compare
This PR brings in the pf-accordion component, as mentioned in #25