primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.6k stars 4.62k forks source link

accordion tabs are opened after dialog close #12174

Open majkers opened 2 years ago

majkers commented 2 years ago

Describe the bug

Everything is written in https://github.com/primefaces/primeng/issues/9453

Environment

in issue https://github.com/primefaces/primeng/issues/9453

Reproducer

https://stackblitz.com/edit/primeng-dialog-accordion-problem-tqtn9k?file=package.json

Angular version

14.2.10

PrimeNG version

14.2.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

14.17.3

Browser(s)

All

Steps to reproduce the behavior

in issue https://github.com/primefaces/primeng/issues/9453

Expected behavior

in issue https://github.com/primefaces/primeng/issues/9453

mlieu commented 1 year ago

I noticed something similar for DynamicDialog and Dialog in v15/v16 with Accordion and Panel. When the dynamic dialog is opened, all tabs are quickly expanded and then collapses after a few milliseconds.

When closing the dynamic dialog, all the tabs are re-expanded again before it disappears. It may be hard to see because it happens so quickly.

I was hoping the accordion would remain collapsed the entire time unless the user actually clicks the tabs.

Here is a forked example based off the DynamicDialog docs for v16, but I replaced p-table with p-accordion: https://stackblitz.com/edit/luvqct?file=src%2Fapp%2Fdemo%2Fproductlistdemo.ts

riorudo commented 6 months ago

The error is still present in primeng v17.16.1. Using an accordion in a dialog leads to inconsistent behavior. When closing the dialog, the accordion expands all tabs for a few milliseconds before closing, and when reopening the dialog, the tabs are open. Checkout this simple example.

bvx5009 commented 6 months ago

Issue also exists if you're using p-sidebar component. Opening a sidebar on the second attempt will open all the accordions.

Demo: https://stackblitz.com/edit/z4x4wd

sarudev commented 4 months ago

Still happening with v17.18.0, it's so annoying

Tom-DevWeb commented 4 months ago

Le problème existe également si vous utilisez le composant p-sidebar. L'ouverture d'une barre latérale à la deuxième tentative ouvrira tous les accordéons.

Démo : https://stackblitz.com/edit/z4x4wd

I confirm bug with sidebar. How resolve this? I'm at version 17.18.4.

bvx5009 commented 4 months ago

Le problème existe également si vous utilisez le composant p-sidebar. L'ouverture d'une barre latérale à la deuxième tentative ouvrira tous les accordéons. Démo : https://stackblitz.com/edit/z4x4wd

I confirm bug with sidebar. How resolve this? I'm at version 17.18.4.

for a work around I've used a skeleton loader with a setTimeout function. On hide, set the loader to true and on show set it to false after small amount of time allowing items to render properly inside the p-sidebar.

public onPanelClick(): void {
   //we use signal in the template for the visible property that can be opened from x amount of places
    this.myService.showSidebar();
    setTimeout(() => {
      this.loading = false;
    }, 350);
  }
 public onHideSidebarClick(): void {
    this.myService.hideSidebar();
    this.loading = true;
  }
Ar-Kareem commented 2 weeks ago

This is still happening to me on angular 18.2.7 and primeng 17.18.9

for a p-accordion inside a p-dialog, when the dialog closes then opens again, all accordions inside it are fully expanded.

Here's an example, first time opening the dialog (looks good) image

close the dialog then reopen it... all accordions are expanded! and the tiny arrow directions are all wrong! image