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

Iconfield : The iconfield component does not work when used in conjunction with the Password component #5804

Closed
nekorrrr opened this issue May 31, 2024 · 4 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@nekorrrr
Copy link

Describe the bug

The iconfield component does not work when used in conjunction with the Password component

Reproducer

https://stackblitz.com/edit/iasvn4?file=src%2FApp.vue

PrimeVue version

4.0.0-beta.4

Vue version

3.x

Language

ES6

Build / Runtime

Vite

Browser(s)

EDGE@laster

Steps to reproduce the behavior

No response

Expected behavior

No response

@nekorrrr nekorrrr added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 31, 2024
@m-meier
Copy link
Contributor

m-meier commented May 31, 2024

The problem seems to be that the IconField CSS expects the input element to be on the same level as the icon. However in case of the password component the input is wrapped in a div which causes invalid padding to be set and issues with z-index. This is only a problem for icon at the start of the field. An icon in the end of the input works.

As a workaround until this is fixed you could manually overwrite the styles (add z-index: 1 to the icon and the correct padding to the inputStyle) as seen here: https://stackblitz.com/edit/iasvn4-aczq3m?file=src%2FApp.vue

@nekorrrr
Copy link
Author

The problem seems to be that the IconField CSS expects the input element to be on the same level as the icon. However in case of the password component the input is wrapped in a div which causes invalid padding to be set and issues with z-index. This is only a problem for icon at the start of the field. An icon in the end of the input works.

As a workaround until this is fixed you could manually overwrite the styles (add z-index: 1 to the icon and the correct padding to the inputStyle) as seen here: https://stackblitz.com/edit/iasvn4-aczq3m?file=src%2FApp.vue

Thank you for your answer. I will use this method until the final solution arrives.

@tugcekucukoglu
Copy link
Member

Thanks for the solution. It seems the demo solves the problem.

@callumgare
Copy link

callumgare commented Jan 12, 2025

@tugcekucukoglu I believe this should be re-opened. The demo provides dirty hack to workaround the issue, a clever one but a workaround none the less. This should be fixed at the library level so people get confused why it doesn't work, google the issue, land here, then need to implement the workaround themselves.

This issue also appears to be closely related to multiple other issues involving the password component and icons:

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

4 participants