@jsenv/dom 0.17.70 → 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.
Files changed (2) hide show
  1. package/dist/jsenv_dom.js +22 -8
  2. 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.hasAttribute("popover")) {
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/dom",
3
- "version": "0.17.70",
3
+ "version": "0.17.71",
4
4
  "type": "module",
5
5
  "description": "DOM utilities for writing frontend code",
6
6
  "repository": {