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

Improve autocomplete compatibility for sign-in form #11598

Closed
wants to merge 3 commits into from

Conversation

aduth
Copy link
Contributor

@aduth aduth commented Dec 5, 2024

🛠 Summary of changes

Updates the sign-in form to assign autocomplete=username to the email address field.

This resolves a log message that's output in Chrome when all levels of console logging are visible:

image

To simulate this and add regression coverage, the logging preference for the Capybara Selenium ChromeDriver has been changed to output all logs, so that it'd be caught by existing log output checking.

While we accept email addresses as the username, autocomplete=username appears to be the correct value for use in a sign-in form.

Related resources:

📜 Testing Plan

Verify no console output:

  1. Go to http://localhost:3000
  2. Open Chrome DevTools console
  3. If dropdown shows "Default levels", expand and ensure "Verbose" is checked (screenshot)
  4. Refresh the page
  5. Verify no console output related to autocomplete attribute

Verify test coverage:

  1. git checkout main -- app/views/devise/sessions/new.html.erb
  2. rspec spec/features/accessibility/visitor_pages_spec.rb:6
  3. See output:
  1) Accessibility on pages that do not require authentication login / root path
     Failure/Error: raise BrowserConsoleLogError.new(javascript_errors) if javascript_errors.present?
     
     BrowserConsoleLogError:
       Unexpected browser console logging:
     
       http://127.0.0.1:58253/ - [DOM] Input elements should have autocomplete attributes (suggested: "username"): (More info: https://goo.gl/9p2vKq) %o

aduth added 2 commits December 5, 2024 11:19
Previously ignored informational messages
User-Facing Enhancements, Sign-in, Improve autocomplete compatibility for sign-in form
@aduth
Copy link
Contributor Author

aduth commented Dec 18, 2024

This would be a good change to make (both the autocomplete itself and the changes to catch informational logging), but there's a lot of existing issues that need to be found.

Most of them seem to be around adding hidden fields for username on a page that includes a password field, similar to what we do for account creation:

<%= text_field_tag('username', @email_address.email, hidden: true, autocomplete: 'username') %>

There's a lot of password fields in our application and each one doesn't immediately have access to an appropriate email address, so will require thoughtful implementation to fix each.

Not something I have the bandwidth to take on the side, but will plan to either ticket or revisit this in the future.

@aduth aduth closed this Dec 18, 2024
@aduth aduth deleted the aduth-input-username-autocomplete branch December 18, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants