@jsenv/dom 0.17.16 → 0.17.17
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 +24 -0
- package/package.json +1 -1
package/dist/jsenv_dom.js
CHANGED
|
@@ -12894,6 +12894,16 @@ const DRAG_EXCLUDED_SELECTOR = ["input", "textarea", "select", '[contenteditable
|
|
|
12894
12894
|
const DRAG_AXES_ATTRIBUTE = "data-travel-by-drag";
|
|
12895
12895
|
const WHEEL_AXES_ATTRIBUTE = "data-travel-by-wheel";
|
|
12896
12896
|
|
|
12897
|
+
// A surface the browser paints in the top layer: it is still a DOM descendant
|
|
12898
|
+
// of whatever it was written in, and it is nowhere near it on screen — it
|
|
12899
|
+
// covers everything. So a gesture that happened on it is not the gesture of any
|
|
12900
|
+
// box it merely sits on top of, and every walk up the tree from the pointer
|
|
12901
|
+
// ends here: the boxes above are behind, and behind is not under the finger.
|
|
12902
|
+
const TOP_LAYER_SELECTOR = [":popover-open", "dialog:modal", ":fullscreen"].join(",");
|
|
12903
|
+
const isTopLayer = element => {
|
|
12904
|
+
return element.matches(TOP_LAYER_SELECTOR);
|
|
12905
|
+
};
|
|
12906
|
+
|
|
12897
12907
|
/**
|
|
12898
12908
|
* What is left for this box of the axes it travels, once the boxes it CONTAINS
|
|
12899
12909
|
* have taken theirs: a row of slides inside a page that walks between pages, a
|
|
@@ -12908,6 +12918,10 @@ const WHEEL_AXES_ATTRIBUTE = "data-travel-by-wheel";
|
|
|
12908
12918
|
* the browser for the pointer LAST, which is the outermost box — the wrong one,
|
|
12909
12919
|
* and past that point the inner one stops being told anything. So the box that
|
|
12910
12920
|
* does not own the gesture must never ask for it.
|
|
12921
|
+
*
|
|
12922
|
+
* A box lifted into the top layer on the way up takes everything: a popover or a
|
|
12923
|
+
* modal dialog is written inside a slide and painted over the whole screen, so
|
|
12924
|
+
* the slides are nowhere near the finger and none of the axes are left.
|
|
12911
12925
|
*/
|
|
12912
12926
|
const axesLeftBy = (axes, fromElement, stopElement, attribute) => {
|
|
12913
12927
|
if (!stopElement.contains(fromElement)) {
|
|
@@ -12919,6 +12933,11 @@ const axesLeftBy = (axes, fromElement, stopElement, attribute) => {
|
|
|
12919
12933
|
let left = axes;
|
|
12920
12934
|
let element = fromElement;
|
|
12921
12935
|
while (element && element !== stopElement && element.nodeType === 1) {
|
|
12936
|
+
if (isTopLayer(element)) {
|
|
12937
|
+
// The gesture happened on a surface painted over this box, not in it:
|
|
12938
|
+
// there is nothing left of it here, whatever axes are still unclaimed.
|
|
12939
|
+
return "";
|
|
12940
|
+
}
|
|
12922
12941
|
const taken = element.getAttribute(attribute);
|
|
12923
12942
|
if (taken) {
|
|
12924
12943
|
let rest = "";
|
|
@@ -12946,6 +12965,11 @@ const axesLeftBy = (axes, fromElement, stopElement, attribute) => {
|
|
|
12946
12965
|
const scrollRoomTowards = (fromElement, stopElement, axis, sign) => {
|
|
12947
12966
|
let element = fromElement;
|
|
12948
12967
|
while (element && element !== stopElement && element.nodeType === 1) {
|
|
12968
|
+
if (isTopLayer(element)) {
|
|
12969
|
+
// A scroller above a top-layer surface is painted behind it: whatever
|
|
12970
|
+
// room it has left is not room the finger is asking for.
|
|
12971
|
+
return false;
|
|
12972
|
+
}
|
|
12949
12973
|
const size = axis === "x" ? element.clientWidth : element.clientHeight;
|
|
12950
12974
|
const scrollSize = axis === "x" ? element.scrollWidth : element.scrollHeight;
|
|
12951
12975
|
if (scrollSize > size + 1) {
|