Accessibility proposal: add 'lang' attribute to generated views


I’d like to propose a small change that could make a big difference for the accessibility of Rails apps - setting a default language for all generated HTML.

Under the Web Content Accessibility Guidelines it’s better to have something set as a default language than nothing at all. This could be set to lang="en" by default, and it would be up to developers to change that if necessary.

Adding the lang attribute to your page has lots of benefits, which you can read about here.

There are a few templates that already have the lang attribute, but application.html.erb and a good few other templates don’t.


It could be set up in the template to default to I18n.locale

1 Like