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

Move "show password" checkbox on login form #6722

Closed
di opened this issue Sep 27, 2019 · 14 comments · Fixed by #8027
Closed

Move "show password" checkbox on login form #6722

di opened this issue Sep 27, 2019 · 14 comments · Fixed by #8027
Labels
good first issue This issue is ideal for first-time contributors! HTML requires change to HTML files

Comments

@di
Copy link
Member

di commented Sep 27, 2019

From #6040:

@anowlcalledjosh:

This means that the password field now takes two Tab-presses to reach from the username field rather than one, which breaks at least one popular password manager.

If the accessibility issue is more important than avoiding some manual configuration of password managers, then fine (I'm not qualified to make that decision), but the original change to add tabindexes was intentional – see #2824, #2917.

@di:

This has actually been bugging me too. I think we can fix it without adding tab indexes by moving the "Show password" box under the password field.

@nlhkabu @woodruffw Thoughts?

@woodruffw:

Yep, I think this would be a good solution.


Good First Issue: This issue is good for first time contributors. If you've already contributed to Warehouse, work on another issue without this label instead. If there is not a corresponding pull request for this issue, it is up for grabs. For directions for getting set up, see our Getting Started Guide. If you are working on this issue and have questions, feel free to ask them here, #pypa-dev on Freenode, or the pypa-dev mailing list.

@di di added good first issue This issue is ideal for first-time contributors! HTML requires change to HTML files labels Sep 27, 2019
@woodruffw
Copy link
Member

Taking a stab at this.

ddaan pushed a commit to ddaan/warehouse that referenced this issue Oct 4, 2019
@di
Copy link
Member Author

di commented Oct 4, 2019

@woodruffw Looks like we might already have a PR: #6755

@woodruffw
Copy link
Member

Whoops! Ignore me then 😅

@di
Copy link
Member Author

di commented Oct 4, 2019

Although heads up @ddaan, that doesn't quite do what was described in this issue. We don't want to use tabindex.

@woodruffw
Copy link
Member

woodruffw commented Oct 4, 2019

Dropping a non-tabindex diff for reference (the other pages also need to be changed):

diff --git a/warehouse/templates/accounts/login.html b/warehouse/templates/accounts/login.html
index 56a5e327..ab676b3a 100644
--- a/warehouse/templates/accounts/login.html
+++ b/warehouse/templates/accounts/login.html
@@ -64,17 +64,13 @@
         </div>
 
         <div data-controller="password" class="form-group">
-          <div class="split-layout">
+          <div>
             <label for="password" class="form-group__label">
               {% trans %}Password{% endtrans %}
               {% if form.password.flags.required %}
               <span class="form-group__required">{% trans %}(required){% endtrans %}</span>
               {% endif %}
             </label>
-            <label for="show-password">
-              <input data-action="change->password#togglePasswords" data-target="password.showPassword"
-                id="show-password" type="checkbox">&nbsp;{% trans %}Show password{% endtrans %}
-            </label>
           </div>
           {{ form.password(placeholder=gettext("Your password"), required="required", class_="form-group__input", autocomplete="current-password", spellcheck="false", data_target="password.password", **{"aria-describedby":"password-errors"}) }}
           <div id="password-errors">
@@ -86,6 +82,12 @@
             </ul>
             {% endif %}
           </div>
+          <div>
+            <label for="show-password">
+              <input data-action="change->password#togglePasswords" data-target="password.showPassword"
+                id="show-password" type="checkbox">&nbsp;{% trans %}Show password{% endtrans %}
+            </label>
+          </div>
         </div>
 
         <div class="form-group">

@ddaan
Copy link

ddaan commented Oct 4, 2019

Although heads up @ddaan, that doesn't quite do what was described in this issue. We don't want to use tabindex.

Oops, I totally missed the word "without" 🙈 . Moving the checkbox down would still make you tab an extra time to the login button. This could be avoided by hitting the enter button, but it will be an issue for the registration form.

@bittner
Copy link

bittner commented Apr 13, 2020

I'd suggest to use an "eye" icon (visually) placed inside the password field to show and hide the typed password (example). Not sure if you already have this on the radar; I can't see it from the code sample.

@SanketDG
Copy link

I will be taking this up. Since Warehouse already uses FontAwesome, it'd be easy to integrate this as part of the password input itself.

@di
Copy link
Member Author

di commented Apr 13, 2020

I think we want to keep the existing checkbox and "Show password" label for accessibility reasons. We just want to move it. The diff in #6722 (comment) looks like what we're looking for if someone can turn it into a PR.

@bittner
Copy link

bittner commented Apr 13, 2020

It should be feasible to both keep the checkbox, technically, for accessibility reasons and show a clickable 👁️ icon, which operates the checkbox, to everyone else who is not a screen reader application. I think we're looking for that as a solution.

The visual representation of a checkbox misleads people into thinking "Remember on this computer" (the common use case for login forms involving a checkbox). This is dangerous, because users may automatically check the control as a habit, which will in turn show the password -- not nice in a screen sharing session! 💣

@nlhkabu
Copy link
Contributor

nlhkabu commented Apr 26, 2020

This sounds like a good solution @bittner.

I agree that the eye icon is ideal, so if we can implement this without affecting accessibility (screen readers, tab order for keyboard users) that would be great.

@bittner
Copy link

bittner commented Apr 26, 2020

If you need any help with the implementation please let me know!

@nlhkabu
Copy link
Contributor

nlhkabu commented Apr 26, 2020

If you want to make a start @bittner, that would be great.

@di is also offering pairing sessions, if you want to walk through this with another dev: https://twitter.com/di_codes/status/1245079525156847616 :)

@bittner
Copy link

bittner commented Apr 26, 2020

Thanks for the hints on pairing. (I installed the software he mentions in the tweet for now and tried to bring up the project with docker-compose.) I took a look at the code. If we could use plain CSS the solution could be elegant:

  • #password[type=text] + ... ➜ class="fa fa-eye-slash"
  • #password[type=password] + ... ➜ class="fa fa-eye"

With FontAwesome, since we must use their classes in the HTML, we'd need to set the classes with JavaScript, which most likely will mix data logic and presentation (e.g. in password_controller.js).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue This issue is ideal for first-time contributors! HTML requires change to HTML files
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants