primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Password input with reactive form, eyeball icon initially outside box until clicked

Open Thorski opened this issue 2 years ago • 19 comments

[x ] bug report => Search github for a similar issue or PR before submitting

Please demonstrate your case at stackblitz by using the issue template below. Issues without a test case have much less possibility to be reviewd in detail and assisted.

https://stackblitz.com/edit/angular-bdvuuo-ypaemo?file=src/app/app.component.html

Current behavior Use p-password with a reactive form control <p-password [formControl]="pwFormControl" [toggleMask]="true" [feedback]="false"></p-password>

The eyeball will be positioned outside the input box. Clicking inside the input box resizes it and applies classes and makes it look correct.

Expected behavior Eyeball should be positioned correctly

Minimal reproduction of the problem with instructions See stackblitz https://stackblitz.com/edit/angular-bdvuuo-ypaemo?file=src/app/app.component.html

  • Angular version: 12.2.7

  • PrimeNG version: 12.2.1 This does NOT happen in 12.2.0, only in 12.2.1

Thorski avatar Oct 28 '21 17:10 Thorski

I confirm, have this bug too

kwolfy avatar Oct 31 '21 19:10 kwolfy

I confirm, same problem

pedroBento1993 avatar Nov 05 '21 10:11 pedroBento1993

Here is a workaround that appears to work, but it is not very nice... as it accesses the private 'cd' member in the password component.

` @ViewChild(Password) passwordComponent: Password;

ngAfterViewInit() { this.passwordComponent['cd'].detectChanges(); } `

Thorski avatar Nov 05 '21 12:11 Thorski

as a workaround, you can use styleClass

<p-password [feedback]="false" [toggleMask]="true" formControlName="password" id="password" styleClass="p-password p-component p-inputwrapper p-input-icon-right"></p-password>

omaihuru avatar Nov 12 '21 12:11 omaihuru

I have the same problem, happening in 13.0.2 too.

martinovicdev avatar Dec 10 '21 08:12 martinovicdev

Seems like [ngCLass] is not working with reactive form. Another UGLY workaround is: <p-password id="password" #pass [ngClass]="pass.containerClass()" name="password" [formControl]="password" [toggleMask]="true" [feedback]="false" ></p-password>

majkers avatar Dec 13 '21 13:12 majkers

 Try once and see magic 

.p-inputtext,.p-password {
    width: 100% !important;
  }
.pi-eye {
    position: absolute;
    margin-left: -32px;
    margin-top: 17px;
}

rahul54784 avatar Jan 04 '22 14:01 rahul54784

<p-password formControlName="password" [toggleMask]="true" styleClass="p-password p-component p-inputwrapper p-input-icon-right">

Worked for me

rahul54784 avatar Jan 05 '22 17:01 rahul54784

Issue still exists on version 13.1.0

Jafried15 avatar Jan 20 '22 07:01 Jafried15

I have the same issue on version 12.2.0

AlbaSS18 avatar Jan 31 '22 12:01 AlbaSS18

I confirm. I have the same problem on version 13.0.4. Here is a fork of their example

zakharenkov avatar Feb 01 '22 08:02 zakharenkov

any official fixes?

edraft avatar Feb 20 '22 13:02 edraft

Issue still exists on version 13.2.0.

Found something interesting I guess. Thorski mentioned, that this has not been a problem on 12.2.0, but since 12.2.1.

So i went to their changelog, and found following addition in 12.2.1:

p-password | onFocus and onBlur Event #10736

Maybe this one will help to figure out the problem.

th1210 avatar Mar 03 '22 14:03 th1210

I have the same problem but in the version "primeng": "^13.0.4"

as a workaround, you can use styleClass

<p-password [feedback]="false" [toggleMask]="true" formControlName="password" id="password" styleClass="p-password p-component p-inputwrapper p-input-icon-right"></p-password>

Workaround => styleClass="p-password p-component p-inputwrapper p-input-icon-right" works

GianLucaFinelli avatar Mar 22 '22 01:03 GianLucaFinelli

I confirm the issue still exist in the version "13.3.2" :(

zedbay avatar Mar 30 '22 20:03 zedbay

I confirm the issue still exist in the version "13.1.0".

And this workaround is usefull, but i'm added to this styles "w-full", it's work.

as a workaround, you can use styleClass

<p-password [feedback]="false" [toggleMask]="true" formControlName="password" id="password" styleClass="p-password p-component p-inputwrapper p-input-icon-right"></p-password>

GreedLine avatar Mar 31 '22 06:03 GreedLine

On version 13.3.3 I had the same problem. Solved using styleClass with only "p-input-icon-right"

<span class="p-float-label"> <p-password id="float-label" [toggleMask]="true" [formControl]="control" styleClass="p-input-icon-right"></p-password> <label for="float-label">{{label}}</label> </span>

Thanks for raising the issue.

Anon31 avatar May 29 '22 19:05 Anon31

Can confirm still exists in 13.4.1

jonnysamps avatar Jun 19 '22 19:06 jonnysamps

I have the same problem but in the version "primeng": "^13.0.4"

@omaihuru as a workaround, you can use styleClass

<p-password [feedback]="false" [toggleMask]="true" formControlName="password" id="password" styleClass="p-password p-component p-inputwrapper p-input-icon-right">

Workaround => styleClass="p-password p-component p-inputwrapper p-input-icon-right" works for me

Thanks for raising the issue.

Kuncha98 avatar Aug 05 '22 04:08 Kuncha98

Still an issue. Would be nice to not have to use one of these workarounds.

Thorski avatar Aug 29 '22 13:08 Thorski

Maybe it https://github.com/primefaces/primeng/pull/11416/files fix them also

JuanSeBestia avatar Aug 30 '22 21:08 JuanSeBestia

I have the same problem but in the version "primeng": "^13.0.4"

@omaihuru as a workaround, you can use styleClass

<p-password [feedback]="false" [toggleMask]="true" formControlName="password" id="password" styleClass="p-password p-component p-inputwrapper p-input-icon-right">

Workaround => styleClass="p-password p-component p-inputwrapper p-input-icon-right" works for me

Thanks for raising the issue.

How did you discover that it was solved like this, it worked perfectly for me, thanks.

murgaratone avatar Aug 30 '22 21:08 murgaratone

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,

mertsincan avatar Nov 09 '22 20:11 mertsincan

Tested on version 14.2.1. Everything is great.

zakharenkov avatar Nov 10 '22 06:11 zakharenkov

as a workaround, you can use styleClass

<p-password [feedback]="false" [toggleMask]="true" formControlName="password" id="password" styleClass="p-password p-component p-inputwrapper p-input-icon-right"></p-password>

Thanks, this worked for me

ansyg avatar Dec 06 '22 04:12 ansyg

as a workaround, you can use styleClass

<p-password [feedback]="false" [toggleMask]="true" formControlName="password" id="password" styleClass="p-password p-component p-inputwrapper p-input-icon-right"></p-password>

Thank you, it worked for me

tuyen-cpu avatar Dec 15 '22 05:12 tuyen-cpu

My situation was that I started with an old project that used PrimeNG 11.4.0 and created a new project with the same business logic but with the latest PrimeNG 16.0.2 but carried over an outdated theme.css. Since it seems like we had generated a theme.css from the visual editor a couple of years back, the selector for the icon was wrong:

.p-input-icon-right > i:last-of-type {
	right: 0.5rem;
	color: #6c757d;
}

I generated a random theme and saw that the selector was different:

.p-input-icon-right>.p-icon-wrapper,
.p-input-icon-right>i:last-of-type {

So I added the new selector to the old theme.css file and now icons in the p-password are as they should be. I didn't have to add styleClass="p-password p-component p-inputwrapper p-input-icon-right"

Ban117 avatar Jul 18 '23 09:07 Ban117

Hi @Ban117, In my case was exactly the same thing. With a little difference, I completely replaced all files from "asstes/styles/theme" with their, so that css was/is like that on on their own css files. I downloaded version 16.0.0.

sergiohcis avatar Sep 13 '23 19:09 sergiohcis