Skip to content

Mark Wicket's default pages with English text as English in every locale - #1999

Open
reiern70 wants to merge 2 commits into
masterfrom
error-pages-lang-1924
Open

reiern70 wants to merge 2 commits into
masterfrom
error-pages-lang-1924

Conversation

@reiern70

Copy link
Copy Markdown
Contributor

Closes #1924

Since #1848 (#1870) every WebPage renders lang and dir on its <html> tag from the page locale. PageExpiredErrorPage, AccessDeniedPage, InternalErrorPage, ExceptionErrorPage and BrowserInfoPage are WebPages with fixed English text and no resource bundles, so a session in nl-NL got <html lang="nl-NL" dir="ltr"> on "Page Expired", and a session in Arabic or Hebrew got dir="rtl" too, which mirrored the English page. Screen readers read the English text with the pronunciation of the session language, which fails WCAG 2.2 SC 3.1.1 (Language of Page).

What it does now

  • The five pages have lang="en" on <html> in their markup. A lang in the markup makes WebPage#onHtmlTag leave the tag alone, so they render lang="en" and no dir in every locale.
  • Their HTML 4.01 Transitional doctype is replaced with <!DOCTYPE html>. The old doctype put browsers in limited-quirks mode, which differs from standards mode only in the line height of images in table cells; these pages and the PageView panel ExceptionErrorPage embeds have none, so they look the same.
  • migration-to-12.md mentions it in the section on lang and dir.

What applications see

An application that shows these pages, or subclasses of them that render their markup, gets lang="en", no dir and the HTML5 doctype, where a 12 snapshot rendered the session language and Wicket 11 no lang at all. Subclasses with markup of their own are not affected. Tests that compare a rendered default page with an expected file need the new doctype and <html> line. To show these pages in the user's language, an application still replaces them with pages of its own.

Not in this PR

  • The sign-in and sign-out pages of wicket-auth-roles have markup variants for several languages, and the sign-in page holds a panel translated into other languages than the page, so lang="en" on its default markup would mark Dutch labels as English.
  • The devutils pages are developer tools, not pages users see. One lang="en" in DevUtilsPage.html would cover all of them, if wanted.
  • Two lines of the accessibility chapter in Add an accessibility chapter to the user guide #1847 describe the old behaviour and need updating once this lands: accessibility_1.adoc ("HTML 4.01 doctype and English text that Wicket marks with the language of the session") and accessibility_2.adoc ("The default error pages get the language of the session on English text").

Backport

None: #1870 is only on master.

Tests

  • New EnglishPagesLangTest renders each of the five pages in nl-NL, ar-EG and he-IL and asserts lang="en" and no dir, and asserts <!DOCTYPE html> right before <html. All 20 cases fail without the markup change.
  • mvn clean verify -Pjs-test is green.

Since GitHub issue #1848 (pull request #1870) every WebPage renders lang
and dir on its <html> tag from the page locale. PageExpiredErrorPage,
AccessDeniedPage, InternalErrorPage, ExceptionErrorPage and
BrowserInfoPage are WebPages with fixed English text and no resource
bundles, so a session in nl-NL got <html lang="nl-NL" dir="ltr"> on
"Page Expired", and a session in Arabic or Hebrew got dir="rtl" too,
which mirrored the English page. Screen readers read the English text
with the pronunciation of the session language, which fails WCAG 2.2
success criterion 3.1.1 (Language of Page).

The five pages now have lang="en" on <html> in their markup. A lang in
the markup makes WebPage#onHtmlTag leave the tag alone, so they render
lang="en" and no dir in every locale. Their HTML 4.01 Transitional
doctype, which put browsers in limited-quirks mode, is replaced with
<!DOCTYPE html>. Limited-quirks mode differs from standards mode only
in the line height of images in table cells, and these pages have none,
so they look the same.

An application that shows these pages, or subclasses of them that
render their markup, now gets lang="en", no dir and the HTML5 doctype,
where a Wicket 12 snapshot rendered the session language and Wicket 11
no lang at all. Subclasses with markup of their own are not affected.
Tests that compare a rendered default page with an expected file need
the new doctype and <html> line. To show the pages in the language of
the user, an application still replaces them with pages of its own.

The sign-in and sign-out pages of wicket-auth-roles and the devutils
pages have English text as well and are left alone. The auth-roles
pages have markup variants for several languages, and the sign-in page
holds a panel translated into other languages than the page, so
lang="en" on its default markup would mark Dutch labels as English. The
devutils pages are developer tools, not pages users see.

GitHub issue #1924
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.07%. Comparing base (855edf6) to head (b632ab1).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1999      +/-   ##
============================================
+ Coverage     63.00%   63.07%   +0.06%     
- Complexity    11665    11676      +11     
============================================
  Files          1255     1255              
  Lines         48865    48865              
  Branches       6910     6910              
============================================
+ Hits          30788    30820      +32     
+ Misses        15396    15364      -32     
  Partials       2681     2681              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@papegaaij papegaaij left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks fine to me. I'd say we can drop the changes to the migration guide. The instructions in AGENTS.md were far too broad, causing agents to see every change as worth recording in the migration guide, but this needs no migration at all.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default error pages get the session's lang on English text

3 participants