PageVeilBehavior: Enter or Space pressed twice on a focused button sends two requests
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 74/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- java, javascript
调研方向
Start by reading wicket-veil.js and the PageVeilBehavior and LocalVeilBehavior implementations named in the issue. Trace how the page and local veils handle keyboard events, then check the existing tests for those behaviors. Done means repeated Enter or Space presses on covered controls do not send duplicate requests, while text entry, editable content, and IME composition remain unaffected.
由索引模型根据 Issue 内容生成。
描述
Affects: 11.0.0 and current master
Component: wicket-extensions, PageVeilBehavior, LocalVeilBehavior, wicket-veil.js
What happens
A page with PageVeilBehavior and a form with an AjaxButton whose onSubmit takes a while:
add(new PageVeilBehavior());
form.add(new AjaxButton("save") {
@Override
protected void onSubmit(AjaxRequestTarget target) {
runs.incrementAndGet();
Thread.sleep(2000); // a slow action
}
});
Focus Save with Tab, press Enter, and press Enter again before the answer comes. onSubmit runs twice. Space pressed twice does the same. Clicking twice with the mouse runs it once, as expected.
Checked with real key presses through WebDriver in Chrome 155 and Firefox 124.
Cause
The veil is a transparent div over the page, and it blocks only the mouse; wicket-veil.js says so itself. The focus stays on the button under the veil, so the second key press activates it. Its request waits on channel 0 and is sent once the first one is done.
Fix proposed
While a veil covers an element, drop the keydown (and its keyup) of Enter and Space whose target it covers:
- for the page veil, any element;
- for a local veil, the elements inside its host.
Leave alone the keys that type text:
- Space in text inputs and selects;
- Enter in a
textareaor editable content; - keys during IME composition.
Making the content inert would also block the keyboard. But the page veil is a child of body, so inert would have to go on every other child of body, and it takes the focus away and hides the content from assistive technologies while it lasts.
Workaround
A capturing keydown listener of the application's own, which checks whether a .wicket-veil is in the page.
Related: #1631, #1942. Found while working on reiern70/advanced-widgets#141.
- 主要语言
- Java
- 星标
- 800
- 派生
- 437
- 平均合并
- 21 小时 36 分钟
- 30 天内合并 PR
- 167
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/wicket 的其他 Issue
-
PropertyResolver fails on JDK classes with a non-public field named like the property可能已有人在做 @vaibhavgupta443 今天认领。 未关闭good first issue
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
Stop the autocomplete from accumulating request parameters while typing可能已有人在做 @aryankalantri 今天认领。 未关闭good first issue
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
Validate the report-uri value given to CSPHeaderConfiguration#reportBack可能已有人在做 @AzizOuertani 于 3 天前认领。 未关闭good first issue
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 70/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
jenkinsci/user-guide-ai-chatbot-plugin#132 ·
维护者通常 6 天内回复
-
account assessment course feature lecture
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
bug db/dameng user-priority/P2
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
app:learninggoalhub enhancement good first issue
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100