Skip to content

Replay a click whose release lands on an Ajax veil raised during the press (11.x) - #2002

Open
reiern70 wants to merge 3 commits into
wicket-11.xfrom
veil-lost-click-1944-11.x
Open

reiern70 wants to merge 3 commits into
wicket-11.xfrom
veil-lost-click-1944-11.x

Conversation

@reiern70

Copy link
Copy Markdown
Contributor

Backport of #1996 to wicket-11.x, for GitHub issue #1944.

Stacked on #2001, the 11.x backport of #1995. Its base is veil-keyboard-1943-11.x, so the diff shows only this fix. Merge #2001 first; GitHub then retargets this PR to wicket-11.x.

  • 115f2c3, a clean cherry-pick of Replay a click whose release lands on an Ajax veil raised during the press #1996: when a press starts before a veil comes up and its release lands on the veil, the veil replays the click on the element the browser would have clicked once it is lowered, so a button pressed right after typing into a field that updates on change is no longer lost. The veil example gets such a field next to a Save button, and VeilPageSeleniumTest clicks and taps it with a real mouse and touch.

No API change, nothing to migrate. The click that was lost before now reaches the button once the veil is lowered.

Verified on this branch:

  • mvn clean verify -Pjs-test is green, japicmp included.

This goes in after #1996. If #1996 changes in review, this branch gets the same change.

…press

With a page veil, a field updating on change and a button next to it, a
click on the button right after typing into the field was lost. Pressing
the button takes the focus from the field, which fires its change event
within the mousedown; the channel is free, so the request is sent at once
and the veil is appended before the mouse button comes up. The mouseup
lands on the veil, and the browser clicks the nearest common ancestor of
the mousedown and mouseup targets, the body, not the button. The field was
saved and the button did nothing, whenever the field's round trip outlasted
the press. A tap on a touch screen loses its click the same way: the
compatibility mousedown that moves the focus comes after the pointerup.

Wicket.Veil now remembers the element of a mousedown that does not land on
a veil. When the matching mouseup lands on a veil, it works out the element
the browser would have clicked without the veil, the common ancestor of the
pressed element and the element under the veil at the release point, and
clicks it once the veil is lowered and no other veil covers it. Nothing is
replayed when that ancestor holds the veil, because the browser's own click
reached it, as for a press dragged off the button onto the page. The
replay is skipped when the element is hidden or disabled by then, or when
a new press started outside the veil meanwhile; a press on the veil leaves
it pending. If the response replaced the element, the click goes to the
element now carrying its id, or that of its closest ancestor with an id
that does not hold the veil.

The issue proposed pointerdown and pointerup. The mouse events are used
instead because with touch the change event, and so the veil, comes after
the pointerup, which then never lands on the veil; the compatibility mouse
events see the lost click for the mouse and for touch alike.

An application sees the click it lost before: the button's handlers run
once the veil is lowered, through HTMLElement.click(), so the replayed
event is not trusted and carries no coordinates.

VeilPage gets a field updating on change next to a Save button, and
VeilPageSeleniumTest clicks Save with a real mouse and taps it with a real
touch right after typing, and drags a press off Save onto the field.

GitHub issue #1944
# Conflicts:
#	wicket-extensions/src/test/js/veil-test.js
…ly once

Review of the click replay of Wicket.Veil found these problems:

- A press on the veil returned early without forgetting the press before
  it, and only a left mouseup forgot it. When the mouseup of a press never
  came, as for a link dragged away, which fires dragstart and dragend but
  no mouseup, a later click on a veil raised by a request the mouse did
  not start was replayed on that element once the veil was lowered. A
  press on the veil and a dragstart now forget the press, and a pending
  replay stays in place.
- The browser still sends its own click to the common ancestor of the
  pressed element and the veil: the host of a local veil, the body for the
  page veil. A delegated click handler on a veiled row ran once for that
  click and once more for the replay, and an Ajax click behaviour on the
  host sent two requests. When a replay is recorded, the click that comes
  with the release is dropped now if its target holds the veil; a click
  in a later task is left alone. Each press makes one click, the replayed
  one.
- HTMLElement.click() sends a click without ctrlKey, metaKey, shiftKey or
  altKey, so a Ctrl- or Cmd-click on a link released on the veil
  navigated the current tab, and a Shift-click lost its Shift. A release
  with a modifier held is no longer replayed, which leaves it as lost as
  it was without the replay.
- A mouse event sent to the document or to a text node threw a TypeError
  in the window listeners; those targets are ignored now.

New QUnit tests cover a press whose release never came, a dragged element,
the modifiers, the browser's click on the host and on the body, a replay
onto an ancestor below the body, and mouse events sent to the document or
a text node. VeilPageSeleniumTest records the clicks that reach the
window: a click or tap released on the veil makes one click, on Save, and
a press dragged off Save onto the field one click, on their form. That
test was named as if nothing were replayed for it, and is renamed.

An application no longer gets the browser's click on the veiled host or
the body next to a replayed click, and gets no click for a release with a
modifier held.

GitHub issue #1944
@reiern70

Copy link
Copy Markdown
Contributor Author

Mirrored the review changes of #1996 here: a0e45e0 merges the updated veil-keyboard-1943-11.x, and 7739a68 is a clean cherry-pick of cdf7eba. The veil script, its QUnit tests and VeilPageSeleniumTest are identical to the master branch.

Base automatically changed from veil-keyboard-1943-11.x to wicket-11.x November 24, 2026 13:49
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.

1 participant