Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set html[lang] during navigation #1035

Merged
merged 1 commit into from
Oct 23, 2023
Merged

Conversation

seanpdoyle
Copy link
Contributor

Closes #967

Change the <html> element's [lang] attribute during navigation. Currently, this isn't possible from applications (without a lot of trouble), since the turbo:before-render event is scoped to the newBody.

In order to support this behavior, change the PageSnapshot constructor to accept an instance of HTMLHtmlElement (the <html> element) so that that element can be accessible from the PageRenderer.

Closes [hotwired#967][]

Change the `<html>` element's `[lang]` attribute during navigation.
Currently, this isn't possible from applications (without a lot of
trouble), since the [turbo:before-render][] event is scoped to the
`newBody`.

In order to support this behavior, change the `PageSnapshot` constructor
to accept an instance of [HTMLHtmlElement][] (the `<html>` element) so
that that element can be accessible from the `PageRenderer`.

[hotwired#967]: hotwired#967
[turbo:before-render]: https://turbo.hotwired.dev/reference/events
[HTMLHtmlElement]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLHtmlElement
@afcapel afcapel merged commit e087856 into hotwired:main Oct 23, 2023
1 check passed
@afcapel
Copy link
Collaborator

afcapel commented Oct 23, 2023

Nice one, thanks @seanpdoyle 🙏

@seanpdoyle seanpdoyle deleted the issue-967 branch October 23, 2023 13:31
@seanpdoyle
Copy link
Contributor Author

@afcapel thank you for merging this! I wonder if it's worth merging other (or all?) attributes as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Update the html lang attribute
2 participants