Problem/Motivation

Follow up from #2467863: Login form's aria-describeby points to an element that doesn't exist and #1955282: Disable Autocapitalize and Autocorrect on user login forms:
According to theses documentations, autocorrect="off" and autocapitalize="off" are deprecated. It should be set to "none" instead.
Also, it may be not enough: considering Firefox, spellcheck="false" should be added.
Finally, note that none of this is valid to W3C, thus it will anyway add markup validation errors
spellcheck="false"
Mozilla response on autocapitalization
Safari's approach

Proposed resolution

- change autocorrect="off" and autocapitalize="off" to autocorrect="none" and autocapitalize="none"
- add spellcheck="false"

Remaining tasks

- discuss
- patch
- review

User interface changes

None

API changes

None

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug because it's a fix in an already developed and released component.
Issue priority Normal because impact is small and limited. Nothing is broken here in the sense of "not working" properly.
Unfrozen changes Unfrozen because it only changes a small impact markup generation.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JesseSturgis’s picture

This sounds like a great solution. I know how to set those attributes, autocorrect and autocapitalize, to 'none', but I'm not sure how to add spellcheck to the form in order to set it to FALSE. It appears that in /core/modules/user/src/Form/UserLoginForm.php that spellcheck is already set to false, but I don't see it getting outputted in the HTML in Chrome's inspector. Any idea why? I apologize - first time contrib.

public function buildForm(array $form, FormStateInterface $form_state) {
    $config = $this->config('system.site');

    // Display login form:
    $form['name'] = array(
      '#type' => 'textfield',
      '#title' => $this->t('Username'),
      '#size' => 60,
      '#maxlength' => USERNAME_MAX_LENGTH,
      '#description' => $this->t('Enter your @s username.', array('@s' => $config->get('name'))),
      '#required' => TRUE,
      '#attributes' => array(
        'autocorrect' => 'off',
        'autocapitalize' => 'off',
        'spellcheck' => 'false',
        'autofocus' => 'autofocus',
      ),
    );
JesseSturgis’s picture

Issue summary: View changes
JesseSturgis’s picture

Issue summary: View changes
JesseSturgis’s picture

Issue summary: View changes
Scott Weston’s picture

FileSize
235.04 KB

@JesseSturgis, in Firefox, spellcheck="false" is appearing for me. Maybe the issue you experienced in #1 is because Chrome is dropping it?

JesseSturgis’s picture

FileSize
1.04 KB

Confirmed, Scott, thanks. I forgot to switch branches. So, this patch changes autocapitalize and autocorrect to 'none.'

Scott Weston’s picture

Happy to help.

Should the field be updated in core/modules/user/src/Form/UserPasswordForm.php (the password reset request form) as well?

Also, be sure to update issues you offer patches on to "Needs Review" so that the community can review and verify it's working!

JesseSturgis’s picture

Status: Active » Needs review

Good call. Apologies - I'm a new contrib, still learning the ropes. As I understand it, the fields are being updated on UserPasswordForm.php through a patch on issue #2467863 as a way to address W3C compatability, whereas this issue is set up just to address how these to attributes deprecate across devices.

Scott Weston’s picture

I didn't realize there was a separate issue for that. Cheers!

Scott Weston’s picture

Status: Needs review » Reviewed & tested by the community

autocomplete and autocapitalize are now 'none' in the login form.

  • alexpott committed 9f403fb on 8.0.x
    Issue #2487808 by JesseSturgis, Scott Weston: autocorrect="off" and...
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 9f403fb and pushed to 8.0.x. Thanks!

Thanks for adding the beta eval to the issue summary.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.