-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
🎙️ a11y: update html lang attribute #3636
Merged
danny-avila
merged 8 commits into
danny-avila:main
from
jacobcolyvan:a11y/html-lang-attribute
Aug 30, 2024
Merged
🎙️ a11y: update html lang attribute #3636
danny-avila
merged 8 commits into
danny-avila:main
from
jacobcolyvan:a11y/html-lang-attribute
Aug 30, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jacobcolyvan
changed the title
a11y: update html lang attribute
🎙️ a11y: update html lang attribute
Aug 14, 2024
danny-avila
requested changes
Aug 16, 2024
Thank you for this and thanks for considering doing this without packages. Both are pretty lightweight so I'm okay with this approach |
jacobcolyvan
force-pushed
the
a11y/html-lang-attribute
branch
from
August 19, 2024 12:24
b3d3a33
to
6f5bc7a
Compare
Thanks @danny-avila, I've resolved those issues. |
danny-avila
approved these changes
Aug 30, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Closes #3458
This implements approach discussed in #3458, which in sum is to:
Client side, to do this I replaced managing
lang
choice in local storage with cookies. This meant I had to add thejs-cookie
package to the client. I looked at managing the cookies without the dependency, but I think this gives us a bit more reliability and sets us up to use cookies more in the future if we choose to do so.This does however require users to re-choose their language as we're no longer using local storage to manage this data, so it introduces a minor breaking change. So once this update is installed users will need to re-choose their language (though it will fallback to the browser preferred language).
Server-side, this accesses the cookie in the request, opens the
index.html
file and replaces the lang attribute before returning it. This also add thecookie-parser
package, but this is recommended by express.This feels a little messy but I wasn't sure of another way to do it without adding a templating engine.
Change Type
Testing
[Tested via serving the frontend via the api]:
langcode
cookie.langcode
in the initial markup.Test Configuration:
This does not work if you're running the frontend in dev.
Checklist
Please delete any irrelevant options.