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: aria-expanded attribute missing when PanelMenu items are collapsed #6430

Closed
blesildaramirez opened this issue Sep 18, 2024 · 2 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@blesildaramirez
Copy link

Describe the bug

When using the PanelMenu component and passing the :expandedKeys prop to control the expanded state of menu items, I noticed an inconsistency with the aria-expanded attribute for the header elements.

The div element with data-pc-section="header" includes the aria-expanded attribute when the menu item is expanded, and its value is set to "true". However, when the item is collapsed, the aria-expanded attribute is removed entirely, instead of being updated to "false".

Reproducer

https://primevue.org/panelmenu/#controlled

PrimeVue version

4.x

Vue version

3.x

Language

ALL

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Go to official demo with :expanded-keys passed as a prop https://primevue.org/panelmenu/#controlled
  2. Inspect the element data-pc-section="header" with aria-label="Users", this is the first item from the panel menu example.
  3. Expand "Users" item, the aria-expanded="true" is added in the element attributes.
  4. Collapse "Users" item. the aria-expanded disappears. The data-p-active is also removed here, it stays on some of the examples so I think it should stay as well, having the value "false" when the item is collapsed.

Expected behavior

  • The aria-expanded attribute should remain on the header element, regardless of whether the item is expanded or collapsed.
  • When the item is expanded, aria-expanded should be "true" and data-p-active should also be "true".
  • When the item is collapsed, aria-expanded should be "false" and data-p-active should also be "false".
@blesildaramirez blesildaramirez added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 18, 2024
@tugcekucukoglu
Copy link
Member

We think this is not a bug, so we are temporarily closing it. We can move it to Discussions.

@jardakotesovec
Copy link

Hi @tugcekucukoglu,
thank you for checking.

Would like to support this bug report, as it breaks the accessibility for screen readers. Which was main the reason why we wanted to rely on the primevue library.

We discovered it through actual screen reader testing. While tracking down the issue with our own usage of the PanelMenu we discovered that it goes wrong when used in the controlled mode, which is easy to reproduce on your own demo - controlled demo.

Its essential that aria-expanded is correctly applied.

If you can't reproduce it let us know, but its important bug from accessibility point of view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

3 participants