Skip to content

Invalid HTML generated by hidden inputs (autocomplete="off") #46405

@ahukkanen

Description

@ahukkanen

Steps to reproduce

  1. Take any form generated through rails containing hidden inputs (e.g. the _method or token inputs)
  2. Copy the HTML source of that page
  3. Paste this to: https://validator.w3.org/nu/#textarea
  4. See invalid HTML

Invalid HTML

Expected behavior

We would expect the HTML produced by the Rails form helpers to be valid HTML.

Actual behavior

The HTML produced by Rails form helpers is not valid.

System configuration

Rails version: Latest (main branch)

Ruby version: Any compatible version (for the relevant project we are using 3.1.1 if it matters)

Additional context

This functionality originates from #43280 (related issue #42610).

Related discussion:
https://discuss.rubyonrails.org/t/form-with-first-field-value-is-overriden-with-a-token-like-string/74861/4

Related Firefox bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=520561

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions