@jsenv/dom 0.17.69 → 0.17.71
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 +33 -13
- package/package.json +1 -1
package/dist/jsenv_dom.js
CHANGED
|
@@ -7152,14 +7152,7 @@ const getScrollContainer = (arg, { includeHidden } = {}) => {
|
|
|
7152
7152
|
}
|
|
7153
7153
|
return null;
|
|
7154
7154
|
}
|
|
7155
|
-
if (element
|
|
7156
|
-
return getScrollingElement(element.ownerDocument);
|
|
7157
|
-
}
|
|
7158
|
-
if (element.tagName === "DIALOG" && element.matches(":modal")) {
|
|
7159
|
-
return getScrollingElement(element.ownerDocument);
|
|
7160
|
-
}
|
|
7161
|
-
const position = getStyle(element, "position");
|
|
7162
|
-
if (position === "fixed") {
|
|
7155
|
+
if (isScrollBoundary(element)) {
|
|
7163
7156
|
return getScrollingElement(element.ownerDocument);
|
|
7164
7157
|
}
|
|
7165
7158
|
return (
|
|
@@ -7190,6 +7183,9 @@ const findScrollContainer = (element, { includeHidden } = {}) => {
|
|
|
7190
7183
|
if (parent === document) {
|
|
7191
7184
|
return null;
|
|
7192
7185
|
}
|
|
7186
|
+
if (isScrollBoundary(parent)) {
|
|
7187
|
+
return null;
|
|
7188
|
+
}
|
|
7193
7189
|
if (isScrollable(parent, { includeHidden })) {
|
|
7194
7190
|
return parent;
|
|
7195
7191
|
}
|
|
@@ -7198,6 +7194,24 @@ const findScrollContainer = (element, { includeHidden } = {}) => {
|
|
|
7198
7194
|
return null;
|
|
7199
7195
|
};
|
|
7200
7196
|
|
|
7197
|
+
// A popover, a modal dialog or a fixed box is not scrolled by the boxes around
|
|
7198
|
+
// it: the page is its scroll container, and the parent walk of any element
|
|
7199
|
+
// inside it stops there too. A scrolling box between that boundary and the
|
|
7200
|
+
// outer ancestors would otherwise be found, although nothing it scrolls moves
|
|
7201
|
+
// the element.
|
|
7202
|
+
const isScrollBoundary = (node) => {
|
|
7203
|
+
if (node.nodeType !== 1) {
|
|
7204
|
+
return false;
|
|
7205
|
+
}
|
|
7206
|
+
if (node.hasAttribute("popover")) {
|
|
7207
|
+
return true;
|
|
7208
|
+
}
|
|
7209
|
+
if (node.tagName === "DIALOG" && node.matches(":modal")) {
|
|
7210
|
+
return true;
|
|
7211
|
+
}
|
|
7212
|
+
return getStyle(node, "position") === "fixed";
|
|
7213
|
+
};
|
|
7214
|
+
|
|
7201
7215
|
const getSelfAndAncestorScrolls = (element, startOnParent) => {
|
|
7202
7216
|
let scrollX = 0;
|
|
7203
7217
|
let scrollY = 0;
|
|
@@ -15870,11 +15884,14 @@ const isAncestorOpen = (ancestor) => {
|
|
|
15870
15884
|
*
|
|
15871
15885
|
* A <dialog> or a [popover] is only ever a surface, and the UA hides a closed
|
|
15872
15886
|
* one outright (display: none), so nothing inside has a box: answered from the
|
|
15873
|
-
* markup, without touching the layout.
|
|
15874
|
-
*
|
|
15875
|
-
*
|
|
15876
|
-
*
|
|
15877
|
-
*
|
|
15887
|
+
* markup, without touching the layout. A trigger says what it is too: its
|
|
15888
|
+
* `aria-controls` names the element its aria-expanded speaks for, so its own
|
|
15889
|
+
* subtree is on screen whether or not that element is — answered from the
|
|
15890
|
+
* markup as well. Anything else — a <details> whose <summary> stays on screen,
|
|
15891
|
+
* a bare [aria-expanded] — is asked of the layout instead: a closed custom
|
|
15892
|
+
* surface is display:none through the library's own closed-state CSS
|
|
15893
|
+
* ([navi-hidden], :not([popover])), so nothing inside one answers true here,
|
|
15894
|
+
* while everything a trigger keeps on screen does.
|
|
15878
15895
|
*
|
|
15879
15896
|
* The layout question is a forced style recalculation. Asked once per element
|
|
15880
15897
|
* from a mount that also writes styles between the questions, each one costs a
|
|
@@ -15892,6 +15909,9 @@ const isDisplayedDespiteClosedAncestor = (element, ancestor) => {
|
|
|
15892
15909
|
if (ancestor.tagName === "DIALOG" || ancestor.hasAttribute("popover")) {
|
|
15893
15910
|
return false;
|
|
15894
15911
|
}
|
|
15912
|
+
if (ancestor.hasAttribute("aria-controls")) {
|
|
15913
|
+
return true;
|
|
15914
|
+
}
|
|
15895
15915
|
if (typeof element.checkVisibility !== "function") {
|
|
15896
15916
|
// Nothing to tell the two apart with: leave the caller treating the closed
|
|
15897
15917
|
// ancestor as hiding this element.
|