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

p-dropdown and p-multiselect: generated HTML has duplicate id #14284

Closed
hstiekema opened this issue Dec 6, 2023 · 5 comments
Closed

p-dropdown and p-multiselect: generated HTML has duplicate id #14284

hstiekema opened this issue Dec 6, 2023 · 5 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@hstiekema
Copy link

hstiekema commented Dec 6, 2023

Describe the bug

A p-dropdown or p-multiselect component with an id (<p-dropdown id="some-id">) results in duplicate ids. The p-dropdown element will get a div inside it with the same id as the p-dropdown element.
The same effect occurs on p-multiselect

Environment

Any

Reproducer

https://stackblitz.com/edit/github-q5rtf2?file=src%2Fapp%2Fapp.component.html

Angular version

16.2.12

PrimeNG version

16.9.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.18.2

Browser(s)

No response

Steps to reproduce the behavior

Create any p-dropdown or p-multiselect and assign it an id

Expected behavior

There are no duplicate IDs

@hstiekema hstiekema added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 6, 2023
@hstiekema hstiekema changed the title p-dropdown: generated HTML has duplicate id p-dropdown and p-multiselect: generated HTML has duplicate id Dec 15, 2023
@AdamOakman
Copy link

I can only confirm this issue affects ui test automation based on assumption that id attributes are unique in the DOM. Would be nice if we had it fixed

@balkarov
Copy link

+1

@egonokhov
Copy link

egonokhov commented Apr 10, 2024

I found a workaround, I use property binding for id and it generates only one element with such id.
<p-dropdown [id]="'some-id'" [options]="options"></p-dropdown>

@mertsincan
Copy link
Member

Hi,

So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you reopen the issue so we can include it in our roadmap?
Please don't forget to add your feedback as a comment after reopening the issue. These will be taken into account by us and will contribute to the development of this feature. Thanks a lot for your understanding!

Best Regards,

@hstiekema
Copy link
Author

I've just verified with primeng 17.18.12 and the original problem still occurs as reported.

I don't think I can reopen the issue (I probably don't have the right permissions)

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

5 participants