-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add reveal eye to password form control #2219
Conversation
Hi, Thanks in advance. |
@@ -4,7 +4,44 @@ | |||
|
|||
namespace Atk4\Ui\Form\Control; | |||
|
|||
use Atk4\Ui\Button; | |||
use Atk4\Ui\Js\JsExpression; | |||
|
|||
class Password extends Line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on whatwg/html#7293 it is true that native solution does not exist in all browsers currently.
IE - at least https://stackoverflow.com/questions/61449079/how-to-hide-the-eye-from-a-password-input-in-ms-edge-and-ie#61450596 is needed to supress the native behaviour of IE, or do we want to keep native eye where supported?
Firefox - https://connect.mozilla.org/t5/ideas/add-a-reveal-password-function-for-logins/idi-p/1140 - did you know there is native (but I agree not much intuitive) reveal - can we turn on/off the native one?
Chrome - it seems there is no native solution (except when using 3rd party extension)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I meant a more native ATK4 solution with more Js functions instead of a big javascript blob... :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IE - I tested Windows 7 and 10, it seems Microsoft does everything to kill IE in favor of Edge - in both systems, when I opened IE, Edge was opened instead. Edge is based on Chrome. And in Edge and Chrome there is no native reveal icon added. So we do not need any additional code to coexist with the native reveal.
…value was lost between reloads.
Well done. One more question - you initially introduced |
And one more question - https://jsfiddle.net/fv2bwyq5/ - In the demo the focus is kept when a div is clicked. I do not fully understand why, but the reveal/unreveal click currently removes focus from the password, but the focus should be kept as in the demo when a div is clicked. |
Thanks, even though you've made it better... :) |
I checked 2 different applications, 1 an AccessPoint looses focus on the password field when the eye is pressed, Acronis on their on-line management platform doesn't. Anwyay, it is an easy fix, I'll commit it now. |
Based on https://stackoverflow.com/questions/8735764/prevent-firing-focus-event-when-clicking-on-div I meant to use native So only #2219 (comment) remains and we are ready to go! |
It was a neat idea, it doesn't work in practice! :) |
I love this PR, thank you for this core contribution ❤ |
This is an addition to the Password form-control which adds an eye to toggle password visibility.
The JS-script part maybe should be more ATK4 friendly but that is above my current knowledge, I will learn with help.