Skip to content

Commit

Permalink
fix(esl-panel): fix the falsy state of animation in the default open …
Browse files Browse the repository at this point in the history
…panel in esl-panel-group

Co-authored-by: ala'n (Alexey Stsefanovich) <astsefanovich@exadel.com>
  • Loading branch information
dshovchko and ala-n committed May 24, 2024
1 parent 6f59414 commit 64925e0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/modules/esl-panel-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ESLPanelGroup.register();

- `has-opened` - readonly attribute that indicates whether the panel group has opened panels
- `current-mode` - readonly attribute that indicates the currently applied rendering mode of the panel group
- `animating` - a marker of animation process running

### Events

Expand Down
5 changes: 5 additions & 0 deletions src/modules/esl-panel-group/core/esl-panel-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ export class ESLPanelGroup extends ESLBaseElement {
/** Readonly attribute that indicates whether the panel group has opened panels */
@boolAttr({readonly: true}) public hasOpened: boolean;

/** Active while animation in progress */
@boolAttr({readonly: true}) public animating: boolean;

/** Height of previous active panel */
protected _previousHeight: number = 0;

Expand Down Expand Up @@ -268,13 +271,15 @@ export class ESLPanelGroup extends ESLBaseElement {

/** Pre-processing animation action */
protected beforeAnimate(): void {
this.$$attr('animating', true);
CSSClassUtils.add(this, this.animationClass);
}

/** Post-processing animation action */
protected afterAnimate(silent?: boolean): void {
this.style.removeProperty('height');
CSSClassUtils.remove(this, this.animationClass);
this.$$attr('animating', false);

if (silent) return;
this.$$fire(this.AFTER_ANIMATE_EVENT, {bubbles: false});
Expand Down
2 changes: 1 addition & 1 deletion src/modules/esl-panel/core/esl-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class ESLPanel extends ESLToggleable {

/** Handles post animation process to initiate after animate step */
protected postAnimate(capturedBy?: ESLPanelGroup | null): void {
if (capturedBy) {
if (capturedBy && capturedBy.animating) {
capturedBy.$$on({
event: capturedBy.AFTER_ANIMATE_EVENT,
once: true
Expand Down

0 comments on commit 64925e0

Please sign in to comment.