How to fix html has lang on Adobe Commerce (Magento)
Add a valid `lang` attribute to the `<html>` element so browsers, screen readers, and search engines know what language your page is written in.
Steps for Adobe Commerce (Magento)
- In your Magento admin, go to Content → Design → Configuration.
- Select the store view you want to update and click Edit.
- Under the HTML Head section, check for any overrides, but the primary control is the locale set in Stores → Configuration → General → General → Locale Options → Locale.
- The `lang` attribute is output in your theme's root template. Navigate to your theme directory (e.g., app/design/frontend/Vendor/theme/Magento_Theme/templates/root.phtml) and verify the `<html>` tag uses `<?php /* @escapeNotVerified */ echo $htmlAttributes ?>` or directly includes the lang attribute.
- If the tag is missing `lang`, add it: `<html lang="<?= $block->escapeHtmlAttr($currentLocale) ?>">` — you may need to pass the locale from your layout XML or block class.
- Clear the Magento cache (System → Cache Management → Flush Magento Cache) and verify via View Source.
What is html has lang?
Every HTML page should declare its primary language in the opening `<html>` tag using a `lang` attribute — for example, `<html lang="en">` for English. This single attribute tells browsers, screen readers, and search-engine crawlers what human language the page content is written in. WCAG Success Criterion 3.1.1 ("Language of Page") requires it. A common mistake is using the XML version (`xml:lang`) instead of the standard HTML `lang` attribute — only `lang` is valid in HTML documents.
Screen readers use the `lang` attribute to select the correct pronunciation engine and voice profile; without it, a visually-impaired customer may hear your entire site read aloud in the wrong language, making it effectively unusable. This is a Level A WCAG violation — the lowest bar for accessibility compliance — and is frequently cited in accessibility audits and legal complaints under the ADA, the European Accessibility Act, and equivalent laws worldwide, exposing you to real legal and financial risk. Search engines also use the declared language to serve your pages to the right audiences, so a missing or wrong `lang` value can quietly undermine your international SEO. Fixing it takes less than five minutes and has zero negative side effects.
See the complete Html has lang guide for every platform and the full background.
Not sure if your Adobe Commerce (Magento) store has this?
Run a free SEOLZ scan — we’ll find html has lang and every other issue across your whole site.
Scan my site free