@aiszlab/relax 1.2.35 → 1.2.37

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.
@@ -40,6 +40,9 @@ class ScrollLocker {
40
40
  // if locked, do not lock again
41
41
  if (this.#locked.has(element))
42
42
  return;
43
+ // if target is not scrollable, do not lock
44
+ if (!isOverflow(element))
45
+ return;
43
46
  this.#locked.set(element, setStyle(element, {
44
47
  overflow: 'hidden',
45
48
  width: `calc(100% - ${this.barSize.width}px)`
@@ -2,4 +2,4 @@
2
2
  * @description
3
3
  * if is overflow
4
4
  */
5
- export declare function isOverflow(): boolean;
5
+ export declare function isOverflow(element?: HTMLElement): boolean;
@@ -2,9 +2,13 @@
2
2
  * @description
3
3
  * if is overflow
4
4
  */
5
- function isOverflow() {
6
- return (document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) &&
7
- window.innerWidth > document.body.offsetWidth);
5
+ function isOverflow(element = document.body) {
6
+ if (element === document.body) {
7
+ return (document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) &&
8
+ window.innerWidth > document.body.offsetWidth);
9
+ }
10
+ // not body
11
+ return element.scrollHeight > element.clientHeight;
8
12
  }
9
13
 
10
14
  export { isOverflow };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiszlab/relax",
3
- "version": "1.2.35",
3
+ "version": "1.2.37",
4
4
  "description": "react utils collection",
5
5
  "type": "module",
6
6
  "exports": {