reiern70 opened a new issue, #1943:
URL: https://github.com/apache/wicket/issues/1943
**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:
```java
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 `textarea` or 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]