Skip to content

Conversation

@jaylinski
Copy link
Contributor

@jaylinski jaylinski commented May 8, 2023

Providing a lang attribute with a valid language tag according to "RFC 5646: Tags for Identifying Languages (also known as BCP 47)" on the <html> element will help screen reading technology determine the proper language to announce. The identifying language tag should describe the language used by the majority of the content of the page. Without it, screen readers will typically default to the operating system's set language, which may cause mispronunciations.

Source

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html#accessibility_concerns

Closes #19965

@jaylinski jaylinski requested a review from a team as a code owner May 8, 2023 14:10
@jonkoops
Copy link
Contributor

jonkoops commented May 9, 2023

@jaylinski we actually have an issue open to implement this #19965 for all of the UIs, would you be willing to implement that under this PR?

@jaylinski jaylinski requested a review from a team as a code owner May 9, 2023 13:15
@ghost ghost added the team/ui label May 9, 2023
@jaylinski
Copy link
Contributor Author

@jonkoops Thanks for referencing the issue! I pushed the changes.

I took a look at the UI tests. Should I write a test for it? Something like this:

@FindBy(xpath = "//html")
private WebElement htmlRoot;

String lang = htmlRoot.getAttribute("lang");
assertThat(lang, "en");

@jonkoops
Copy link
Contributor

jonkoops commented May 9, 2023

@jaylinski if you are up for writing some tests to verify this code works that would be awesome yeah.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreported flaky test detected, please review

@ghost
Copy link

ghost commented May 9, 2023

Unreported flaky test detected

If the below flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.model.infinispan.CacheExpirationTest#testCacheExpiration

Keycloak CI - Store Model Tests

java.lang.AssertionError: 
threads didn't terminate in time: [main (RUNNABLE):
	at [email protected]/sun.management.ThreadImpl.dumpThreads0(Native Method)
	at [email protected]/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:521)
	at [email protected]/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:509)
...

Report flaky test

org.keycloak.testsuite.model.infinispan.CacheExpirationTest#testCacheExpiration

Keycloak CI - Store Model Tests

java.lang.AssertionError: 
threads didn't terminate in time: [main (RUNNABLE):
	at [email protected]/sun.management.ThreadImpl.dumpThreads0(Native Method)
	at [email protected]/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:521)
	at [email protected]/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:509)
...

Report flaky test

@jonkoops
Copy link
Contributor

@jaylinski any progress on those tests? :)

@jaylinski jaylinski requested review from a team as code owners May 30, 2023 14:06
@jaylinski jaylinski requested a review from a team May 30, 2023 14:06
@jaylinski
Copy link
Contributor Author

jaylinski commented May 30, 2023

@jaylinski any progress on those tests? :)

@jonkoops I added a test for the login-page. Please review.

Note that I only added the lang-attribute to the login- and account-layout, since the other layouts don't always have a internationalizationEnabled- or currentLanguageTag-value.

@jonkoops
Copy link
Contributor

Very nice, thanks for adding some tests! Would it also be possible to add another test for the Account Console?

Note that I only added the lang-attribute to the login- and account-layout, since the other layouts don't always have a internationalizationEnabled- or currentLanguageTag-value.

I think that is valid yes, we can split these missing ones out into separate issues and resolve them later.

@jonkoops
Copy link
Contributor

@ssilvert could I ask you to review the Java code as well? It looks good to me, but I prefer to have another expert look 😉

Copy link
Contributor

@ssilvert ssilvert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ssilvert ssilvert merged commit 4036324 into keycloak:main May 30, 2023
@jaylinski jaylinski deleted the patch-1 branch May 30, 2023 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add lang attribute to HTML tag of UIs

3 participants