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

Dropdown, MultiSelect, AutoComplete, CascadeSelect: aria-label missing from inner ul element #14790

Closed
akashuwtw opened this issue Feb 12, 2024 · 5 comments
Assignees
Labels
PRO Support Issue was reported by PRO User Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@akashuwtw
Copy link

akashuwtw commented Feb 12, 2024

Describe the bug

We are trying to set aria-label for p-dropdown which is getting successfully applied to the main p-dropdown component, but is missing from it's inner ul element.

We are following the steps as per documented here.

Environment

OS: Windows 10

Reproducer

No response

Angular version

16.2.7

PrimeNG version

16.5.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.16.0

Browser(s)

Chrome 121.0.6167.161, Edge 121.0.2277.112

Steps to reproduce the behavior

<p-dropdown data-test="type" [options]="typeOptions" formControlName="type" placeholder="Select type"></p-dropdown>
<p-dropdown data-test="type" [options]="typeOptions" formControlName="type" ariaLabel="Select type"></p-dropdown>
<p-dropdown data-test="type" [options]="typeOptions" formControlName="type" aria-label="Select type"></p-dropdown>

Expected behavior

aria-label should be applied to inner ul element

@akashuwtw akashuwtw added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 12, 2024
@cetincakiroglu cetincakiroglu added this to the 17.7.0 milestone Feb 13, 2024
@cetincakiroglu cetincakiroglu removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 13, 2024
@cetincakiroglu
Copy link
Contributor

cetincakiroglu commented Feb 14, 2024

Hi,

ariaLabel and ariaLabelledBy are given to focusable input elements. The test we performed using Axe DevTools shows that there is no issue as you mentioned.

correct use:

<span id="dd1">Options</span>
<p-dropdown ariaLabel="myAriaLabel"/>

This is a DOM node from the basic example in primeng.org. As you see here list item has aria-label and it's generated by option label. The ariaLabel prop you set in the dropdown is for the focusable element that replaces the  in the dropdown, not for the list items.

<li role="option" 
     pripple="" 
     class="p-ripple p-element p-dropdown-item p-focus" 
     id="pn_id_7_0"  
     aria-label="New York" 
     aria-setsize="5" 
     aria-posinset="1" 
     aria-selected="false" 
     data-p-focused="true" 
     data-p-highlight="false" 
     data-p-disabled="false">
.....
</li>

@cetincakiroglu cetincakiroglu added Status: Discussion Issue or pull request needs to be discussed by Core Team Resolution: Needs More Information More information about the issue is needed to find a correct solution PRO Support Issue was reported by PRO User labels Feb 14, 2024
@akashuwtw
Copy link
Author

Hi,

We are performing cypress axe tests to check for any a11y violations, and cypress has reported this violation for ul element under p-dropdown

image

<ul role="listbox" class="p-dropdown-items ng-star-inserted" id="pn_id_5_list">
https://dequeuniversity.com/rules/axe/4.8/aria-input-field-name?application=axeAPI

Since, the ul element has listbox role, it become an input field and hence should have an aria-label.

The li elements under ul element have aria-label applied. No issues there.
image

Regards,
Akash

@cetincakiroglu
Copy link
Contributor

Hi,

Thanks for the clarification. In this case, do you need a default assigned aria-label value or do you want to send the aria-label via an input?

@akashuwtw
Copy link
Author

Hi,

The default aria-label would be fine for us.

Regards,
Akash

@cetincakiroglu
Copy link
Contributor

Hi,

Thanks a lot for the feedback, we'll add an aria label to the element.

@cetincakiroglu cetincakiroglu added Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add and removed Status: Discussion Issue or pull request needs to be discussed by Core Team Resolution: Needs More Information More information about the issue is needed to find a correct solution labels Feb 14, 2024
@cetincakiroglu cetincakiroglu changed the title Dropdown: aria-label missing from inner ul element Dropdown, MultiSelect, AutoComplete, CascadeSelect: aria-label missing from inner ul element Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PRO Support Issue was reported by PRO User Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

No branches or pull requests

3 participants