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

PanelMenu nested subitems no longer get the expanded prop #15403

Closed
digitalcraftco opened this issue Apr 29, 2024 · 4 comments · Fixed by #16790
Closed

PanelMenu nested subitems no longer get the expanded prop #15403

digitalcraftco opened this issue Apr 29, 2024 · 4 comments · Fixed by #16790
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@digitalcraftco
Copy link
Contributor

digitalcraftco commented Apr 29, 2024

Describe the bug

In previous version 16.x.x 2nd & 3rd level nested sub menu items also had an expanded prop in the model when toggled open. In versions 17.x.x they are no longer getting the expanded prop. Only the 1st level parent items.

This makes it impossible to persist the expanded state of the panel menu beyond the first level. On a page refresh the menu will be reset to it's original state and user loses context.

{
    expanded: true,
    label: "Admin",
    items: [
         { 
            expanded: true,   < --- ! Not added here anymore. Same with deeper levels
            label: "Tasks",
            items: [...]
        },
        ...
    ]
 }

Environment

Angular 18.0.1

Reproducer

Toggle the menu a few items deep. The model will update below. Notice no nested items get an expanded attribute. Only top level parents. If you manually add expanded attribute to nested child (Documents) it won't update either. Notice how Files changes from false to true.

https://stackblitz.com/edit/s5kubx-5x7cem?file=src%2Fapp%2Fpanel-menu-basic-demo.html

Angular version

18.0.1

PrimeNG version

17.18.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

20.9.0

Browser(s)

No response

Steps to reproduce the behavior

Toggle a panel menu with 3rd or 4th level items. Inspect the model and you will see the nested parent items do not have the expanded: true property.

Expected behavior

No response

@digitalcraftco digitalcraftco added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 29, 2024
@digitalcraftco digitalcraftco changed the title PanelMenu nested subitems no longer get the expanded attribute PanelMenu nested subitems no longer get the expanded prop Apr 29, 2024
@tarockx
Copy link

tarockx commented Aug 7, 2024

Are there any news on this issue? I've been using PrimeNG 17.x.x and I can confirm there is no way to get the expanded state of a sub-item. At the moment I'm working around this by fetching the corresponding <li> element from the DOM and checking the aria-expanded attribute, but it would be good (and make the most sense, in my opinion) to have native support for this.

@flier268
Copy link

So do I

@digitalcraftco
Copy link
Contributor Author

@cagataycivici @cetincakiroglu 4 month bump. Can someone triage this so I can decide if I need to try and PR a fix or if there are other reasons why this happened? Many thanks!

@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Aug 14, 2024
@mertsincan mertsincan added this to the 17.18.13 milestone Nov 21, 2024
@github-project-automation github-project-automation bot moved this to Done in PrimeNG Dec 6, 2024
@ben-lewis-wtw
Copy link

ben-lewis-wtw commented Feb 3, 2025

What version of PrimeNG was this fixed in? As far as I can tell expanded is still not properly updated for nested nodes on 17.18.15, but is fixed by 18.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

7 participants