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

feat(accordion): support nodes preservation #1370

Closed
wants to merge 1 commit into from
Closed

feat(accordion): support nodes preservation #1370

wants to merge 1 commit into from

Conversation

jiayihu
Copy link
Contributor

@jiayihu jiayihu commented Mar 11, 2017

Before submitting a pull request, please make sure you have at least performed the following:

  • read and followed the CONTRIBUTING.md guide.
  • built and tested the changes locally.
  • added/updated any applicable tests.
  • added/updated any applicable API documentation.
  • added/updated any applicable demos.

Fixes #1161 and #1167
In this case I left hidden because there are no examples of accordion component in Bootstrap 4 examples for Card and active would require writing custom CSS to hide the panel

@@ -199,6 +207,14 @@ export class NgbAccordion implements AfterContentChecked {
*/
isOpen(panelId: string): boolean { return this._states.get(panelId); }

/**
* @internal

Choose a reason for hiding this comment

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

Using @internal will make it fail in the AoT mode, please remove. I think that it would be better to just in-line this logic in a template and IMO we should just remove this method altogether.

Copy link
Contributor Author

@jiayihu jiayihu Mar 13, 2017

Choose a reason for hiding this comment

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

Are you sure about @internal? I believe AOT has problems with private methods/fields used in the template. Note then that isOpen also has @internal comment.

About inlining the logic I completely agree but there's currenctly a strange behaviour where null is converted into false and the attribute is the added hidden="false". It's then nevertheless selected by Bootstrap CSS selector [hidden] {...}.
I found a similar issue.

Choose a reason for hiding this comment

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

Was pretty sure about the @internal but then noticed that it is used on isOpen... Need to investigate.

In any case let's try to in-line this method (and yes, you need to return null if you want to remove the attribute altogether).

Copy link
Contributor Author

@jiayihu jiayihu Mar 13, 2017

Choose a reason for hiding this comment

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

In any case let's try to in-line this method (and yes, you need to return null if you want to remove the attribute altogether).

The problem is that, with inline null, it becomes false and the attribute is not removed from DOM, it's added as hidden="false" instead. That's the reason of a method. Personally I don't understand why result is different from methods vs inline.

Choose a reason for hiding this comment

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

@jiayihu once again, the main problem with the hidden attribute is that ... you shouldn't use it at all!!! Please use appropriate Bootstrap 4 CSS classes instead, following Bootstrap's markup as documented officially: https://v4-alpha.getbootstrap.com/components/collapse/#accordion-example

BTW, we might need to merge #1332 first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case I left hidden because there are no examples of accordion component in Bootstrap 4 examples for Card and active would require writing custom CSS to hide the panel

I didn't find the example :P Anyway I'll make the proper changes then, thanks for pointing the example.

@pkozlowski-opensource
Copy link
Member

@jiayihu thnx - it looks good, generally speaking but there is one change I need you to do before we can merge this one - please see comments in the code.

@jiayihu
Copy link
Contributor Author

jiayihu commented Mar 15, 2017

@pkozlowski-opensource I replaced hidden with show but it won't work without collapse CSS class added by #1332 .

@pkozlowski-opensource
Copy link
Member

Merged, thnx! Sorry it took so long, been busy with preparing 1.0 release.

Once again, thnx, appreciate all the PRs!

rmeans pushed a commit to fcsa-teamhammer/ng-bootstrap that referenced this pull request Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants