@jsenv/dom 0.17.88 → 0.17.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/jsenv_dom.js +21 -16
  2. package/package.json +1 -1
package/dist/jsenv_dom.js CHANGED
@@ -4520,11 +4520,12 @@ const clickIsSuppressed = (clickEvent) =>
4520
4520
  *
4521
4521
  * The wait also has to hold off the system's own answer to the same gesture: a
4522
4522
  * FINGER held long enough IS the context-menu gesture, and Android's menu (around
4523
- * 500ms) or iOS's callout lands a tenth of a second after the press was answered
4524
- * here. The half of that which is an event is refused below; the half that is not
4525
- * (iOS selecting the word under the finger) is a stylesheet the caller writes on
4526
- * its own elements — `-webkit-touch-callout: none` has to be true before the
4527
- * finger lands, so it cannot be set from here.
4523
+ * 500ms) with the word under the finger selected, or iOS's callout, lands a tenth
4524
+ * of a second after the press was answered here. What of that is an event — the
4525
+ * menu, and the selection outside iOS — is refused below; what is not (iOS
4526
+ * selecting the word under the finger) is a stylesheet the caller writes on its
4527
+ * own elements — `-webkit-touch-callout: none` has to be true before the finger
4528
+ * lands, so it cannot be set from here.
4528
4529
  *
4529
4530
  * THE REFUSAL LASTS THE PRESS, NOT THE WAIT. The system's delay is the longer of
4530
4531
  * the two, so between the moment this wait gives up and the moment the finger
@@ -4645,18 +4646,21 @@ const waitForPressHeld = (
4645
4646
  };
4646
4647
 
4647
4648
  /* A FINGER held down is the system's own context-menu gesture, and the menu it
4648
- raises lands on top of the answer this press was already given. A MOUSE is
4649
- not: its context menu comes from the other button, has nothing to do with
4650
- this press, and is the user asking for the browser's menu — so it is left
4651
- alone, and only a touch press refuses it.
4652
- The listener goes on window, in capture: what answers the press may cover the
4653
- page (a drag backdrop, a popup), and the contextmenu event is then aimed at
4654
- that instead of at the element pressed. */
4649
+ raises, with the word it selects, lands on top of the answer this press was
4650
+ already given. A MOUSE is not: its context menu comes from the other button,
4651
+ has nothing to do with this press, and is the user asking for the browser's
4652
+ menu — so it is left alone, and only a touch press refuses it.
4653
+ The listeners go on window, in capture: what answers the press may cover the
4654
+ page (a drag backdrop, a popup), and both events are then aimed at that
4655
+ instead of at the element pressed. Which is also why the pressed element's
4656
+ own `user-select: none` does not cover the selection: the word selected is
4657
+ the one under the finger when the system answers, in what the hold opened. */
4655
4658
  if (pressEvent.pointerType === "touch") {
4656
- const preventContextMenu = (contextMenuEvent) => {
4657
- contextMenuEvent.preventDefault();
4659
+ const preventSystemAnswer = (event) => {
4660
+ event.preventDefault();
4658
4661
  };
4659
- window.addEventListener("contextmenu", preventContextMenu, true);
4662
+ window.addEventListener("contextmenu", preventSystemAnswer, true);
4663
+ window.addEventListener("selectstart", preventSystemAnswer, true);
4660
4664
  /* The finger letting go, watched for the length of the press rather than for
4661
4665
  the length of the wait: the wait can be over long before the hand is.
4662
4666
  A pointerCANCEL is not the hand letting go, it is the browser saying it is
@@ -4683,7 +4687,8 @@ const waitForPressHeld = (
4683
4687
  window.addEventListener("pointercancel", onPressPointerEnd, true);
4684
4688
  pressCleanupCallbacks.push(() => {
4685
4689
  clearTimeout(menuGraceTimeout);
4686
- window.removeEventListener("contextmenu", preventContextMenu, true);
4690
+ window.removeEventListener("contextmenu", preventSystemAnswer, true);
4691
+ window.removeEventListener("selectstart", preventSystemAnswer, true);
4687
4692
  window.removeEventListener("pointerup", onPressPointerEnd, true);
4688
4693
  window.removeEventListener("pointercancel", onPressPointerEnd, true);
4689
4694
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/dom",
3
- "version": "0.17.88",
3
+ "version": "0.17.90",
4
4
  "type": "module",
5
5
  "description": "DOM utilities for writing frontend code",
6
6
  "repository": {