Skip to content

Commit

Permalink
fix(accordion): include margins during expand animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Kemp committed Nov 30, 2022
1 parent db4cdeb commit 0742dae
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/src/components/accordion/accordion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
max-height: 0;
}

/**
* Prevent margins of content-wrapper
* from collapsing, breaking the animation.
*/
:host(.accordion-expanding) #content-wrapper {
overflow: auto;
}

:host(.accordion-disabled) #header,
:host(.accordion-readonly) #header,
:host(.accordion-disabled) #content,
Expand Down
20 changes: 20 additions & 0 deletions core/src/components/accordion/test/standalone/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,26 @@ <h2>Item In Content</h2>
</ion-accordion>
</ion-accordion-group>
</div>

<div class="grid-item">
<h2>Margins In Content</h2>

<ion-accordion-group value="first">
<ion-accordion value="first">
<ion-item slot="header"> Accordion </ion-item>
<ion-card slot="content" style="margin: 100px 16px">
<ion-card-header>
<ion-card-title>Card Title</ion-card-title>
<ion-card-subtitle>Card Subtitle</ion-card-subtitle>
</ion-card-header>

<ion-card-content>
Here's a small text description for the card content. Nothing more, nothing less.
</ion-card-content>
</ion-card>
</ion-accordion>
</ion-accordion-group>
</div>
</div>
</main>
</body>
Expand Down

0 comments on commit 0742dae

Please sign in to comment.