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

Open Beginner friendly
#1,924 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
html, java
Domain
accessibility

Research direction

The four pages live in the markup.html pages package (PageExpiredErrorPage, AccessDeniedPage, InternalErrorPage, ExceptionErrorPage) and all extend WebPage. Read WebPage#onHtmlTag first to confirm a markup lang wins over the session locale and suppresses dir, then add lang="en" to the <html> tag in each page and swap the HTML 4.01 Transitional doctype for <!DOCTYPE html>. Done means each page renders English text with lang="en" and no dir even when the session locale is nl-NL or RTL; check existing page markup tests for how the rendered tag is asserted.

Written by the indexing model from the issue text.

Description

Since #1870, every WebPage gets lang and dir on its <html> tag from the page locale. Wicket's default error pages extend WebPage, but their text is hard-coded English and they have no resource bundles:

  • PageExpiredErrorPage
  • AccessDeniedPage
  • InternalErrorPage
  • ExceptionErrorPage

A user whose session locale is nl-NL now gets <html lang="nl-NL" dir="ltr"> on a page that reads "Page Expired". Before #1870, lang was missing. Now it is wrong: screen readers read the English text with Dutch pronunciation, which fails WCAG 2.2 SC 3.1.1 (Language of Page, level A). A user with an RTL locale also gets dir="rtl" on English text.

The pages also still use the HTML 4.01 Transitional doctype.

Possible fix: put lang="en" on the <html> tag of these four pages. A markup lang takes precedence in WebPage#onHtmlTag and also suppresses dir. Replace the doctype with <!DOCTYPE html> at the same time. Translating the pages through resource bundles and dropping the markup lang would be the alternative, but contributed translations for them don't exist yet.

The accessibility chapter of the user guide (#1847) recommends replacing these pages with application pages and mentions this behaviour.

Dominant language
Java
Stars
800
Forks
423
Avg merge
1d 1h
Merged PRs (30d)
170

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/wicket

All issues in apache/wicket

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.