passwordhasherplus icon indicating copy to clipboard operation
passwordhasherplus copied to clipboard

Password reveal button not always placed correctly

Open simu opened this issue 6 years ago • 14 comments

After removing the dependency on jquery for the whole extension, my custom password reveal button is not always positioned correctly in relation to the password field.

Goals

  • Improved placement algorithm for the reveal button

simu avatar Feb 27 '19 12:02 simu

I've encountered this a lot. It would be nice if this could be disabled via a setting as well--I generally don't use that button in favor of the url bar toggle.

lord2800 avatar Aug 12 '19 21:08 lord2800

I haven't had much time to work on the extension recently, I'll look into adding an option to disable the reveal button, as fixing the positioning is rather harder than adding another option.

simu avatar Aug 13 '19 07:08 simu

I can maybe poke at it if you give me a bit of guidance on where to look.

lord2800 avatar Aug 13 '19 19:08 lord2800

The button is implemented by hand using some javascript in https://github.com/simu/passwordhasherplus/blob/b9c7f7cccb742028af4760d33654d1f4e803164b/content-script.js#L57-L85

A new option can be implemented in options.html/options.js and used in content-script.js to not create the button by simply not calling createMaskButton() in bind().

simu avatar Aug 13 '19 19:08 simu

I created https://github.com/simu/passwordhasherplus/pull/23 to have an option to disable the button and I'm working on fixing the styles to just anchor it to the bottom right corner. I just need to finish testing my changes, then I'll have a PR for that too.

lord2800 avatar Oct 02 '19 16:10 lord2800

I created https://github.com/simu/passwordhasherplus/pull/25 to fix the button placement as well as a few other minor things. If #23 lands first, I'll have to rebase #25 to handle the new place to call requestAnimationFrame, otherwise I'll have to rebase #23 to do it. Either way, let me know and I'll get the other fixed up.

lord2800 avatar Oct 03 '19 11:10 lord2800

@lord2800 thanks for the contributions, I'll try to have a look ASAP

simu avatar Oct 10 '19 15:10 simu

@lord2800 Sorry for the long delay, work was super busy. I've merged #23. #25 LGTM as well under the assumption that the new call site to initAllElements is properly updated.

simu avatar Oct 31 '19 18:10 simu

On it!

lord2800 avatar Oct 31 '19 20:10 lord2800

While #25 and #28 improve the positioning on some pages, others still struggle, e.g. gitlab.com: image image

I'm going to leave this issue open for now, in case someone (or myself when I'm bored enough) can try to come up with a better way. I think what's missing is that the content-script.js isn't really able to react correctly when already existing elements are moved around. Maybe there's a way to subscribe on position updates for individual elements and react to those, but that's an idea for another day.

simu avatar Oct 31 '19 21:10 simu

I'll see what I can do! Knowing that gitlab has an issue still makes it easier for me to test out different solutions.

lord2800 avatar Oct 31 '19 21:10 lord2800

Other pages which I've found where the button is still placed weird are:

  • Google image

simu avatar Nov 01 '19 14:11 simu

Interesting. I explicitly tested there too. :(

lord2800 avatar Nov 01 '19 15:11 lord2800

maybe my changes to make it work on my default test (https://store.steampowered.com/login/?redir=&redir_ssl=1) (cf. #28) broke it on Google again, but that just shows that it's really tricky to get this right in all cases :(

simu avatar Nov 01 '19 16:11 simu