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

未关闭 适合新手
#1,924 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
html, java
领域
accessibility

调研方向

这四个页面位于 markup.html pages 包中(PageExpiredErrorPage、AccessDeniedPage、InternalErrorPage、ExceptionErrorPage),并且都继承 WebPage。先阅读 WebPage#onHtmlTag,确认标记中的 lang 优先于会话 locale 并抑制 dir,然后在每个页面的 <html> 标签中添加 lang="en",并将 HTML 4.01 Transitional doctype 替换为 <!DOCTYPE html>。完成意味着即使会话 locale 是 nl-NL 或 RTL,每个页面也渲染带有 lang="en" 且没有 dir 的英文文本;查看现有的页面标记测试,了解渲染出的标签是如何断言的。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Java
星标
800
派生
423
平均合并
1 天 1 小时
30 天内合并 PR
170

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/wicket 的其他 Issue

查看 apache/wicket 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。