@jsenv/dom 0.17.6 → 0.17.7
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 +48 -6
- package/package.json +1 -1
package/dist/jsenv_dom.js
CHANGED
|
@@ -7856,7 +7856,19 @@ const css$5 = /* css */`
|
|
|
7856
7856
|
touch-action: none;
|
|
7857
7857
|
user-select: none;
|
|
7858
7858
|
}
|
|
7859
|
+
/* Chrome matches :focus-visible on a programmatic focus, so focusing what the
|
|
7860
|
+
gesture holds draws a ring around an object the user already has under the
|
|
7861
|
+
pointer — a frame blinking for the length of the gesture, saying something
|
|
7862
|
+
the finger knows. The ring stays whole where it earns its place: at the
|
|
7863
|
+
keyboard, outside any gesture.
|
|
7864
|
+
focus({ focusVisible: false }) would say the intent better but does not
|
|
7865
|
+
hold — Chrome's heuristic does not always obey the option (see
|
|
7866
|
+
isMatchingFocusVisible). */
|
|
7867
|
+
[data-drag-focus]:focus-visible {
|
|
7868
|
+
outline: none;
|
|
7869
|
+
}
|
|
7859
7870
|
`;
|
|
7871
|
+
import.meta.css = [css$5, "@jsenv/dom/src/interaction/drag/drag_gesture.js"];
|
|
7860
7872
|
const createDragGestureController = (options = {}) => {
|
|
7861
7873
|
const {
|
|
7862
7874
|
name,
|
|
@@ -8017,7 +8029,6 @@ const createDragGestureController = (options = {}) => {
|
|
|
8017
8029
|
|
|
8018
8030
|
// 2. VISUAL CONTROL: Backdrop for consistent cursor and pointer event blocking
|
|
8019
8031
|
if (backdrop) {
|
|
8020
|
-
import.meta.css = [css$5, "@jsenv/dom/src/interaction/drag/drag_gesture.js"];
|
|
8021
8032
|
const backdropElement = document.createElement("div");
|
|
8022
8033
|
backdropElement.className = "navi_drag_gesture_backdrop";
|
|
8023
8034
|
backdropElement.ariaHidden = "true";
|
|
@@ -8054,10 +8065,12 @@ const createDragGestureController = (options = {}) => {
|
|
|
8054
8065
|
// This also ensure any keydown event listened by the currently focused element
|
|
8055
8066
|
// won't be available during drag
|
|
8056
8067
|
const elementToFocus = focusableElement || document.body;
|
|
8068
|
+
elementToFocus.setAttribute("data-drag-focus", "");
|
|
8057
8069
|
elementToFocus.focus({
|
|
8058
8070
|
preventScroll: true
|
|
8059
8071
|
});
|
|
8060
8072
|
addReleaseCallback(() => {
|
|
8073
|
+
elementToFocus.removeAttribute("data-drag-focus");
|
|
8061
8074
|
// Restore original focus on release
|
|
8062
8075
|
activeElement.focus({
|
|
8063
8076
|
preventScroll: true
|
|
@@ -8589,18 +8602,47 @@ installImportMetaCssBuild(import.meta);/**
|
|
|
8589
8602
|
* starts at the first pixel, without a second threshold to cross.
|
|
8590
8603
|
*/
|
|
8591
8604
|
|
|
8592
|
-
/*
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8605
|
+
/* At module scope, and on the markers rather than on the pressed element: both
|
|
8606
|
+
rules below have to be true BEFORE the finger lands — a stylesheet, never a
|
|
8607
|
+
line of JS in the pointerdown.
|
|
8608
|
+
|
|
8609
|
+
-webkit-touch-callout: iOS shows its callout (Copy / Look Up) and selects the
|
|
8610
|
+
text under the finger on a long press, and does not always route that through
|
|
8611
|
+
an event that can be refused — see preventContextMenu below for the half that
|
|
8612
|
+
is an event.
|
|
8613
|
+
|
|
8614
|
+
touch-action: a touchmove can only be refused if the region was out of the
|
|
8615
|
+
compositor's fast path when the touch BEGAN (see preventTouchScroll in
|
|
8616
|
+
drag_gesture.js, which does the refusing). Left at `auto`, Chrome has already
|
|
8617
|
+
decided the touch is its own by the time a long press turns into a grab, and
|
|
8618
|
+
every preventDefault from then on is a "Unable to preventDefault inside
|
|
8619
|
+
passive event listener" intervention — on Android, a scroll that runs away
|
|
8620
|
+
with the object. Any explicit value other than `auto` is enough: `pan-y` still
|
|
8621
|
+
lets the page scroll and still makes the refusal effective. */
|
|
8597
8622
|
const css$4 = /* css */`
|
|
8598
8623
|
[data-drag-handle],
|
|
8599
8624
|
[data-drag-source] {
|
|
8600
8625
|
-webkit-touch-callout: none;
|
|
8601
8626
|
}
|
|
8627
|
+
[data-drag-handle] {
|
|
8628
|
+
/* A dedicated handle has nothing to share: it takes the gesture on contact. */
|
|
8629
|
+
touch-action: none;
|
|
8630
|
+
}
|
|
8631
|
+
[data-drag-source] {
|
|
8632
|
+
/* A source taken by long press must let the scroll through until the grab —
|
|
8633
|
+
which is exactly what the long press is there to tell apart. Zoom has
|
|
8634
|
+
nothing to do with the gesture and nobody should lose it by resting a
|
|
8635
|
+
finger on a word. */
|
|
8636
|
+
touch-action: pan-y pinch-zoom;
|
|
8637
|
+
}
|
|
8638
|
+
[data-drag-source="x"] {
|
|
8639
|
+
/* The axis is the one thing the caller has to say, being the only one who
|
|
8640
|
+
knows which way what surrounds the source scrolls. */
|
|
8641
|
+
touch-action: pan-x pinch-zoom;
|
|
8642
|
+
}
|
|
8602
8643
|
[data-drag-ignore] {
|
|
8603
8644
|
-webkit-touch-callout: default;
|
|
8645
|
+
touch-action: auto;
|
|
8604
8646
|
}
|
|
8605
8647
|
`;
|
|
8606
8648
|
import.meta.css = [css$4, "@jsenv/dom/src/interaction/drag/drag_after_intent.js"];
|