@jsenv/dom 0.17.66 → 0.17.68
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.
- package/dist/jsenv_dom.js +34 -3
- package/package.json +1 -1
package/dist/jsenv_dom.js
CHANGED
|
@@ -319,11 +319,14 @@ const chainEvent = (customEvent, parentEvent) => {
|
|
|
319
319
|
* which one WAS used — a tap brings the on-screen keyboard up, the trackpad
|
|
320
320
|
* next to it does not.
|
|
321
321
|
*
|
|
322
|
-
*
|
|
322
|
+
* Four readings, because no single one covers every path from a finger to an
|
|
323
323
|
* event:
|
|
324
324
|
* - a touch* event says it outright;
|
|
325
325
|
* - `pointerType` says it on a PointerEvent, which "click" also is in some
|
|
326
326
|
* engines and not in others — hence not the only reading;
|
|
327
|
+
* - the click WebKit dispatches for a tap is a PointerEvent whose `pointerType`
|
|
328
|
+
* says "mouse" while its `pointerId` is the finger's: the press last seen
|
|
329
|
+
* down with that id answers for it (see lastPress below);
|
|
327
330
|
* - `sourceCapabilities.firesTouchEvents` is what is left for the compatibility
|
|
328
331
|
* mouse events a tap synthesizes, where nothing else remembers the finger.
|
|
329
332
|
* Absent outside Chromium, where it costs nothing: the readings above have
|
|
@@ -339,10 +342,30 @@ const isTouchDrivenEvent = (event) => {
|
|
|
339
342
|
// "" on a pointer event the engine could not attribute — not an answer, so
|
|
340
343
|
// it falls through to the last reading rather than being read as "not touch".
|
|
341
344
|
if (event.pointerType) {
|
|
342
|
-
|
|
345
|
+
if (event.pointerType === "touch") {
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
if (lastPress && event.pointerId === lastPress.pointerId) {
|
|
349
|
+
return lastPress.pointerType === "touch";
|
|
350
|
+
}
|
|
351
|
+
return false;
|
|
343
352
|
}
|
|
344
353
|
return event.sourceCapabilities?.firesTouchEvents === true;
|
|
345
354
|
};
|
|
355
|
+
// The press behind the next click: a click follows the pointerup of its own
|
|
356
|
+
// press, and no other press comes between the two. Recorded on window in
|
|
357
|
+
// capture so that nothing lower can hide a press from it.
|
|
358
|
+
let lastPress = null;
|
|
359
|
+
window.addEventListener(
|
|
360
|
+
"pointerdown",
|
|
361
|
+
(pointerdownEvent) => {
|
|
362
|
+
lastPress = {
|
|
363
|
+
pointerId: pointerdownEvent.pointerId,
|
|
364
|
+
pointerType: pointerdownEvent.pointerType,
|
|
365
|
+
};
|
|
366
|
+
},
|
|
367
|
+
{ capture: true, passive: true },
|
|
368
|
+
);
|
|
346
369
|
|
|
347
370
|
/**
|
|
348
371
|
* Whether `event` is a click a pointer press produced, as opposed to one
|
|
@@ -15269,7 +15292,15 @@ const startDragToCarryCopy = (
|
|
|
15269
15292
|
// copy at scale 1 as the "new" state.
|
|
15270
15293
|
clone.removeAttribute("navi-drag-clone");
|
|
15271
15294
|
};
|
|
15272
|
-
|
|
15295
|
+
try {
|
|
15296
|
+
await answer(syncCloneWithDropTarget);
|
|
15297
|
+
} catch {
|
|
15298
|
+
// Coming down on a place can be a QUESTION, and the answer may be
|
|
15299
|
+
// no. Refused, the thing is still where it was and the screen has
|
|
15300
|
+
// to say so: the copy takes the same journey home a refused throw
|
|
15301
|
+
// takes — from wherever it got to, which is where it visibly is.
|
|
15302
|
+
await settleCloneBack(cloneWrapper, draggedElement);
|
|
15303
|
+
}
|
|
15273
15304
|
};
|
|
15274
15305
|
|
|
15275
15306
|
if (dropMeans === "toss") {
|