Skip to content

Commit

Permalink
Fix html tag lang attribute in SSR (#4803)
Browse files Browse the repository at this point in the history
  • Loading branch information
sneridagh committed May 24, 2023
1 parent 0eec24c commit f257f25
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/4803.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix html tag lang attribute in SSR @sneridagh
4 changes: 3 additions & 1 deletion src/helpers/Html/Html.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ class Html extends Component {
} = this.props;
const head = Helmet.rewind();
const bodyClass = join(BodyClass.rewind(), ' ');
const htmlAttributes = head.htmlAttributes.toComponent();

return (
<html lang="en">
<html lang={htmlAttributes.lang}>
<head>
<meta charSet="utf-8" />
{head.base.toComponent()}
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/Html/Html.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ jest.mock('../Helmet/Helmet', () => ({
script: {
toComponent: () => '',
},
htmlAttributes: {
toComponent: () => ({
lang: 'en',
}),
},
}),
}));

Expand Down

0 comments on commit f257f25

Please sign in to comment.