## Rails 8.1におけるRails.configuration.action_view.remove_hidden_field_autocomplete [`config.action_view.remove_hidden_field_autocomplete`](https://railsguides.jp/configuring.html#config-action-view-remove-hidden-field-autocomplete)は、hiddenフィールドから`autocomplete="off"`属性を除去するかどうかの設定です。 ([この機能のPR](https://github.com/rails/rails/pull/55336)と[この機能のCommit](https://github.com/rails/rails/commit/688f671616b2aeb9f80a46e6f358962790df0b20)) [`bin/rails app:update`コマンド](https://railsguides.jp/upgrading_ruby_on_rails.html#%E3%82%A2%E3%83%83%E3%83%97%E3%83%87%E3%83%BC%E3%83%88%E3%82%BF%E3%82%B9%E3%82%AF)が生成する config/initializers/new_framework_defaults_8_1.rbには、 以下のようにこの設定を有効にするコードがあります。 ``` + # Highlight code that triggered redirect in logs. + config.action_dispatch.verbose_redirect_logs = true + ``` ### この機能が導入された背景 この機能は、HTML標準へ より準拠したHTMLをRailsが生成するように追加されました。 具体的には、この機能を有効にしない場合、Railsは以下のような`autocomplete="off"`属性を付けたhiddenフィールドを生成していました。 ```html ``` このautocomplete属性付きのhiddenフィールドはHTML標準に沿っておらず、 [Nu Html Checker](https://validator.w3.org/nu/#textarea)は 以下のメッセージとともに「エラー」として指摘していました。 > An “input” element with a “type” attribute whose value is “hidden” must not have an “autocomplete” attribute whose value is “on” or “off”.